WordPlate is a wrapper around WordPress. It makes developers life easier. It is just like building any other WordPress website with themes and plugins. Just with sprinkles on top.

Overview

WordPlate

WordPlate

WordPlate is simply a wrapper around WordPress. It makes developers life easier. It is just like building any other WordPress website with themes and plugins. Just with sprinkles on top.

Build Status Monthly Downloads Latest Version

Features

  • WordPress + Composer = ♥️

    WordPress is installed using Composer which allows WordPress to be updated by running composer update.

  • Environment Files

    Similar to Laravel, WordPlate puts environment variables within an .env file such as database credentials.

  • WordPress Packagist

    With WordPress Packagist you may manage your WordPress plugins and themes with Composer.

  • Must-use plugins

    Don't worry about client deactivating plugins, must-use plugins is enabled by default.

  • Mail

    If you want to use custom SMTP credentials to send emails, we've a package for that!

  • Laravel Mix

    With Laravel Mix you can quickly get up and running with Webpack to build and minify your CSS and JavaScript.

  • Debugging

    Familiar debugging helper functions are integrated such as dump() and dd().

  • Security

    With the roots/wp-password-bcrypt package we've replaced WordPress outdated and insecure MD5-based password hashing with the modern and secure bcrypt.

Installation

To use WordPlate, you need to have PHP 7.3+ and MySQL 5.7+ installed on your machine.

WordPlate utilizes Composer to manage its dependencies. So, before using WordPlate, make sure you have Composer installed on your machine.

Install WordPlate by issuing the Composer create-project command in your terminal:

composer create-project --prefer-dist wordplate/wordplate blog

Update the database credentials in the .env file:

DB_NAME=database
DB_USER=username
DB_PASSWORD=password

Serve your application using the built-in web server in PHP (or your server of choice) from the public directory:

php -S localhost:8000 -t public/

Visit your application in the browser:

Configuration

Public Directory

After installing WordPlate, you should configure your web server's document / web root to be the public directory. The index.php in this directory serves as the front controller for all HTTP requests entering your application.

Salt Keys

The next thing you should do after installing WordPlate is adding salt keys to your environment file.

Typically, these strings should be 64 characters long. The keys can be set in the .env environment file. If you have not copied the .env.example file to a new file named .env, you should do that now. If the salt keys isn't set, your user sessions and other encrypted data will not be secure.

If you're lazy like us, visit our salt key generator and copy the randomly generated keys to your .env file.

Environment Configuration

It is often helpful to have different configuration values based on the environment where the application is running. For example, you may wish to use a different database locally than you do on your production server.

To make this a cinch, WordPlate utilizes the Dotenv PHP package. In a fresh WordPlate installation, the root directory of your application will contain a .env.example file. If you install WordPlate via Composer, this file will automatically be renamed to .env. Otherwise, you should rename the file manually.

Your .env file should not be committed to your application's source control, since each developer / server using your application could require a different environment configuration. Furthermore, this would be a security risk in the event an intruder gains access to your source control repository, since any sensitive credentials would get exposed.

Read more about environment variables in Laravel's documentation:

Plugins

WordPress Packagist

We've integrated WordPress Packagist which makes it possible to install plugins with Composer. WordPress Packagist mirrors the WordPress plugin and theme directories as a Composer repository.

Install the desired plugins using wpackagist-plugin as the vendor name. Packages are installed in the public/plugins directory.

composer require wpackagist-plugin/hide-updates

This is an example of how your composer.json file might look like:

"require": {
    "wordplate/framework": "^9.4",
    "wpackagist-plugin/hide-updates": "^1.0"
},

Please visit WordPress Packagist for more information and examples.

Must Use Plugins

Must-use plugins (a.k.a. mu-plugins) are plugins installed in a special directory inside the content folder and which are automatically enabled on all sites in the installation.

To install plugins into into the mu-plugins directory, add the plugin name to the installer-paths in your composer.json file:

"installer-paths": {
    "public/mu-plugins/{$name}": [
        "type:wordpress-muplugin",
        "wpackagist-plugin/hide-updates",
    ]
}

Install the plugin using wpackagist-plugin as the vendor name.

composer require wpackagist-plugin/hide-updates

The plugin should now be installed in the public/mu-plugins directory.

Read more about the must-use plugin autoloader in the documentation.

Laravel Mix

Laravel Mix is a clean layer on top of Webpack to make the 80% use case laughably simple to execute. Most would agree that, though incredibly powerful, Webpack ships with a steep learning curve. But what if you didn't have to worry about that?

To get started with Laravel Mix, please visit the documentation.

// Run all mix tasks...
npm run dev

// Run all mix tasks and minify output...
npm run build

Integrations

Below you'll find a list of plugins and packages we use with WordPlate. Some of these projects are maintained by WordPlate and some are created by other amazing developers.

  • Blade

    The package integrates Blade templating system in WordPress.

  • Clean Image Filenames

    The plugin removes special characters from filenames.

  • Extended ACF

    The package provides an object oriented API to register fields, groups and layouts with ACF.

  • Extended CPTs

    The package provides extended functionality to WordPress custom post types and taxonomies.

  • Headache

    The plugin removes a lot of default WordPress stuff you just can't wait to get rid of.

  • Hide Updates

    The plugin hides update notices for updates in WordPress.

  • Mail

    The plugin provides a simple way to add custom SMTP credentials.

Upgrade Guide

Upgrading from 8 to 9
  1. Bump the version number in the composer.json file to ^9.0.

  2. Copy the public/mu-plugins/mu-plugins.php file into your project.

  3. Update the public/.gitignore file to allow the new mu-plugins.php file:

    -mu-plugins/
    +mu-plugins/*
    +!mu-plugins/mu-plugins.php
  4. Run composer update in the root of your project and your app should be up and running!

Upgrading from 7 to 8
  1. WordPlate now requires PHP 7.2 or later.

  2. Bump the version number in the composer.json file to ^8.0.

    Note: WordPlate 8.0 requires WordPress 5.3 or later.

  3. Laravel's helper functions is now optional in WordPlate. If you want to use the functions, install the laravel/helpers package, with Composer, in the root of your project:

    composer require laravel/helpers
  4. Laravel's collections are now optional in WordPlate. If you want to use collections, install the tightenco/collect package, with Composer, in the root of your project:

    composer require tightenco/collect
  5. The mix helper function is now optional in WordPlate. If you want to use the function, install the ibox/mix-function package, with Composer, in the root of your project:

    composer require ibox/mix-function
  6. Replace any usage of asset, stylesheet_url and template_url functions with WordPress's get_theme_file_uri function.

  7. Replace any usage of stylesheet_path and template_path functions with WordPress's get_theme_file_path function .

  8. The base_path and template_slug functions have been removed.

  9. Run composer update in the root of your project and your app should be up and running!

Upgrading from 6 to 7
  1. Bump the version number in the composer.json file to ^7.0.

    Note: WordPlate 7.0 requires WordPress 5.0 or later.

  2. Update the realpath(__DIR__) to realpath(__DIR__.'/../') in the wp-config.php file.

  3. If your public directory isn't named public, add the following line to the wp-config.php file:

    $application->setPublicPath(realpath(__DIR__));
  4. Run composer update in the root of your project and your app should be up and running!

Upgrading from 5 to 6
  1. Bump the version number in the composer.json file to ^6.0.

  2. Update the realpath(__DIR__.'/../') to realpath(__DIR__) in the wp-config.php file.

  3. Run composer update in the root of your project and your app should be up and running!

Upgrading from 4 to 5
  1. Bump the version number in the composer.json file to ^5.0.

  2. Copy and paste the contents of the wp-config.php file into your application.

    Note: Make sure you don't overwrite any of your custom constants.

  3. Run composer update in the root of your project and your app should be up and running!

FAQ

Can I add WordPress constants to the environment file?

This is possible by updating the public/wp-config.php file after the WordPlate application have been created.

$application->run();

+define('WP_ALLOW_MULTISITE', env('WP_ALLOW_MULTISITE', true));

$table_prefix = env('DB_TABLE_PREFIX', 'wp_');

Then you may add the constant to the .env file.

WP_DEFAULT_THEME=wordplate
+WP_ALLOW_MULTISITE=true
Can I rename the public directory?

If you want to rename the public directory you'll need to add the following line to the wp-config.php file:

$application->setPublicPath(realpath(__DIR__));

Please note that you also have to update your composer.json file with your new public directory path before you can run composer update again.

Can I rename the WordPress directory?

By default WordPlate will put the WordPress in public/wordpress. If you want to change this there are a couple of steps you need to go through. Let's say you want to change the default WordPress location to public/wp:

  1. Update the wordpress-install-dir path in your composer.json file.

  2. Update wordpress to wp in wordplate/public/.gitignore.

  3. Update the last line in the public/index.php file to:

    require __DIR__.'/wp/wp-blog-header.php';
  4. Update the WP_DIR environment variable in the .env file to wp.

  5. If you're using WP-CLI, update the path in the wp-cli.yml file to public/wp.

  6. Remove the public/wordpress directory if it exist and then run composer update.

Can I rename the theme directory?

For most applications you may leave the theme directory as it is. If you want to rename the wordplate theme to something else you'll also need to update the WP_THEME environment variable in the .env file.

Can I use WordPlate with Laravel Valet?

If you're using Laravel Valet together with WordPlate, you may use our local valet driver. Create a file named LocalValetDriver.php in the root of your project and copy and paste the class below:



declare(strict_types=1);

final class LocalValetDriver extends BasicValetDriver
{
    public function serves(string $sitePath): bool
    {
        return is_dir($sitePath . '/vendor/wordplate/framework');
    }

    /**
     * @return false|string
     */
    public function isStaticFile(string $sitePath, string $siteName, string $uri)
    {
        $staticFilePath = $sitePath . '/public' . $uri;

        if ($this->isActualFile($staticFilePath)) {
            return $staticFilePath;
        }

        return false;
    }

    public function frontControllerPath(string $sitePath, string $siteName, string $uri): string
    {
        $_SERVER['PHP_SELF'] = $uri;
        $_SERVER['SERVER_NAME'] = $_SERVER['HTTP_HOST'];

        if (strpos($uri, '/wordpress/') === 0) {
            if (is_dir($sitePath . '/public' . $uri)) {
                $uri = $this->forceTrailingSlash($uri);

                return $sitePath . '/public' . $uri . '/index.php';
            }

            return $sitePath . '/public' . $uri;
        }

        return $sitePath . '/public/index.php';
    }

    private function forceTrailingSlash(string $uri): string
    {
        if (substr($uri, -1 * strlen('/wordpress/wp-admin')) == '/wordpress/wp-admin') {
            header('Location: ' . $uri . '/');
            die;
        }

        return $uri;
    }
}

Acknowledgements

WordPlate wouldn't be possible without these amazing open-source projects.

Comments
  • WP-CLI throwing fatal error on use

    WP-CLI throwing fatal error on use

    Hello,

    I'm trying to make WP-CLI work with Wordplate to automate some stuff, but most command seems to throw a Fatal error :

    Stack trace:
    #0 phar://C:/Websites/wordplate/wp/php/WP_CLI/Runner.php(1070): eval()
    #1 phar://C:/Websites/wordplate/wp/php/WP_CLI/Runner.php(1032): WP_CLI\Runner->load_wordpress()
    #2 phar://C:/Websites/wordplate/wp/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runner->start()
    #3 phar://C:/Websites/wordplate/wp/php/bootstrap.php(75): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
    #4 phar://C:/Websites/wordplate/wp/php/wp-cli.php(23): WP_CLI\bootstrap()
    #5 phar://C:/Websites/wordplate/wp/php/boot-phar.php(8): include('phar://C:/Websi...')
    #6 C:\Websites\wordplate\wp(4): include('phar://C:/Websi...')
    #7 {main}
      thrown in phar://C:/Websites/wordplate/wp/php/WP_CLI/Runner.php(1070) : eval()'d code on line 37
    

    I'm currently running PHP 7.2.1, but had the same error on PHP 7.0.8. I'm using the latest version of Composer, 1.6.2. I'm also using the latest version of WP-CLI

    I tried multiple time recreating the autoloader and deleting the vendor folder, but no luck.

    Any idea? Thank you very much!

    bug windows 
    opened by gmarchildon 23
  • Add SSL and VHost to php -S

    Add SSL and VHost to php -S

    Hello,

    I just started using Wordplate. However when using an internal php server I find myself blocked. I would like to create a Vhost with an https / ssl. I already added my vhost in the files hosts etc.

    I would like what was the procedure to follow for this, I have already searched in the existing issues as well as on the documentation, without success.

    Or if there is an alerniatve to the use of an internal php server.

    Waiting for an answer.

    question 
    opened by hocine87 15
  • Please help me with DB Configuration with Wordpress using WordPlate

    Please help me with DB Configuration with Wordpress using WordPlate

    I have installed wordplate using Composer in localhost. It shows me this error:

    image

    And after password set to blank in .env file, it redirects to this: image

    Please help me.

    opened by ankurmakadia 15
  • Error with WordPress 5.0.2

    Error with WordPress 5.0.2

    I get this error if I do a fresh install using Wordplate latest version:

    Notice: Undefined index: path in /var/www/wordplate/public/wordpress/wp-includes/l10n.php on line 919

    It seems to be related to not having a wp-content folder in the project...

    question 
    opened by pjehan 14
  • WooCommerce compatibility

    WooCommerce compatibility

    when running the WooCommerce setup script, it throws an error. seems to have something to do with plate/src/tabs.php on line 20.

    commenting it out let me run the setup, but may be worth looking into.

    Using WP 4.5.3 & WooCommerce 2.6.3

    edit: also running multi site

    opened by nathanaelphilip 14
  • Class 'Dotenv\Environment\DotenvFactory' not found conflit with fiskhandlarn/blade

    Class 'Dotenv\Environment\DotenvFactory' not found conflit with fiskhandlarn/blade

    Hi,

    I have this error when composer update : Fatal error: Uncaught Error: Class 'Dotenv\Environment\DotenvFactory' not found in C:\laragon\www\starter\vendor\illuminate\support\helpers.php:646 Stack trace: #0 C:\laragon\www\starter\public\wp-config.php(65): env('WP_PREFIX', 'wp_') #1 C:\laragon\www\starter\public\wordpress\wp-load.php(42): require_once('C:\\laragon\\www\\...') #2 C:\laragon\www\starter\public\wordpress\wp-blog-header.php(13): require_once('C:\\laragon\\www\\...') #3 C:\laragon\www\starter\public\index.php(37): require('C:\\laragon\\www\\...') #4 {main} thrown in C:\laragon\www\starter\vendor\illuminate\support\helpers.php on line 646

    I use the package blade of @fiskhandlarn to implement blade to my theme but if i remove this of my composer.json, my theme work. An idea to resolve this problem ? I try to reinstall vlucas/dotenv but it's not work.

    Thanks for your help.

    question 
    opened by menegain-mathieu 12
  • Integrate TGM Plugin Activation?

    Integrate TGM Plugin Activation?

    Require and activate plugins on theme activation. Maybe this plugin? http://tgmpluginactivation.com/

    Are there any better ones or is it easy to integrate other way?

    enhancement question 
    opened by puredazzle 12
  • Changing home and siteurl

    Changing home and siteurl

    I'm transferring my site from http to https, and need to change URL scheme in home and siteurl from http to https.

    In WordPress admin panel both "WordPress Address (URL)" shows http://mysite.com/wordpress and is non-editable, "Site Address (URL)" is http://mysite.com and is also grey, wp option get siteurl returns a weird http://:/wordpress string, wp option get home prints http://:.

    wp option update home https://mysite.com and wp option update siteurl https://mysite.com/wordpress succeed, but change nothing, wp option get and WordPress admin page display what they did before.

    I even tried wp option update home https://: and wp option update siteurl https://:/wordpress with no effect as well.

    I wonder how these options are even set? For instance, Bedrock provides WP_HOME and WP_SITEURL environment variables and mentions them in the docs, and in WordPlate docs I found no information about it.

    question 
    opened by mvasin 11
  • Import error on gulp step

    Import error on gulp step

    When I get to the stage in the install process when it's time to run gulp, I get the following error:

    user@host:~$ gulp
    [00:54:03] Failed to load external module babel-core/register
    [00:54:03] Failed to load external module babel/register
    
    /var/www/site/gulpfile.babel.js:1
    (function (exports, require, module, __filename, __dirname) { import elixir fr
                                                                  ^^^^^^
    SyntaxError: Unexpected reserved word
        at Module._compile (module.js:439:25)
        at Object.Module._extensions..js (module.js:474:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Module.require (module.js:364:17)
        at require (module.js:380:17)
        at Liftoff.handleArguments (/usr/local/lib/node_modules/gulp/bin/gulp.js:116:3)
        at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:192:16)
        at module.exports (/usr/local/lib/node_modules/gulp/node_modules/liftoff/node_modules/flagged-respawn/index.js:17:3)
        at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:185:9)
    

    Any thoughts? I'm not familiar with Babel, and attempts to Google this have not proved fruitful.

    Edit: Using the latest version of Wordplate.

    opened by RobertCalise 11
  • Edit User Roles In Configuration

    Edit User Roles In Configuration

    It would be nice if you could specify which user roles that should be supported in the config.php, for more information please see:

    http://codex.wordpress.org/Function_Reference/remove_role

    enhancement 
    opened by puredazzle 11
  • Wordpress doesn't allow to change interface language

    Wordpress doesn't allow to change interface language

    Hi, I don't know if it's a normal behavior, the installer doesn't prospose to select any other language, only english is available in the setting. wp_issue_lang_crop To resolve this issue add this line

    <?php 
    // file: wp-config.php
    define('FS_METHOD', 'direct'); 
    

    in wp-config.php

    bug 
    opened by John-Dormevil 10
Releases(12.4.1)
Owner
WordPlate
WordPlate is a wrapper around WordPress to make developers life easier.
WordPlate
Vite integration for WordPress plugins and themes development.

Vite for WordPress Vite integration for WordPress plugins and themes development. Usage Let's assume we have this plugin files structure: my-plugin/ ├

Dzikri Aziz 48 Jan 2, 2023
Parse DSN strings into value objects to make them easier to use, pass around and manipulate

DSN parser Parse DSN strings into value objects to make them easier to use, pass around and manipulate. Install Via Composer composer require nyholm/d

Tobias Nyholm 77 Dec 13, 2022
WARNING! This software is currently non-functional. - A system which makes installing Jexactyl far, far easier.

Jexactyl Assistant A system which makes installing Jexactyl far, far easier. WARNING ?? This software is currently in heavy alpha testing and WILL NOT

Jexactyl 7 Nov 14, 2022
Makes indexing of your Magento store around x times faster! ‼️ Maintainers wanted!

FastIndexer This module has never been used in production. No more empty results in the frontend due to a long taking reindex process! Integrates seam

Cyrill Schumacher 79 Jul 10, 2022
A trait to make building your own custom Laravel Model Searches a lot easier.

BrekiTomasson\LaravelModelFinder A simple trait that makes building your own custom Laravel Model Searches a lot easier and safer. It ensures that you

Breki Tomasson 3 Nov 27, 2022
A PHP script that converts PMMP-3 Plugins into PMMP-4 plugins

This script tries to convert pm3 plugins to pm4 as good as possible, but sadly not perfect. Please open issues if you find any unexpected behaviour, to help improving this script.

null 43 Dec 3, 2022
Collection of PHP functions, mini classes and snippets for everyday developer's routine life

JBZoo / Utils Collection of PHP functions, mini classes and snippets for everyday developer's routine life. Install composer require jbzoo/utils Usage

JBZoo Toolbox 776 Jun 2, 2022
Game of life developed in PHP with TDD approach

What is Game of Life: https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life Project structure: Engine is in App\Services\LifeEngine.php Tests are in T

Marcella Malune 4 Nov 8, 2021
This project has reached its end-of-life (EOL).

EOL Notice This project has reached its end-of-life (EOL). README Requirements The supported Magento version is 1.9.x Features ajax navigation using h

Catalin Ciobanu 136 Apr 2, 2022
The module for my life story project that contains my ProtonDrive screenshots.

By: Top README.md Read this article in a different language Sorted by: A-Z Sorting options unavailable ( af Afrikaans Afrikaans | sq Shqiptare Albania

Sean P. Myrick V19.1.7.2 1 Aug 26, 2022
A wrapper around symplify/config-transformer used to update recipes and using easy coding standard for generating readable config files.

Symfony Recipes Yaml to PHP Converter This is a wrapper around the symplify/config-transformer used to convert Symfony core recipes which uses .yaml c

Alexander Schranz 3 Nov 24, 2022
⭐ It is an platform for people to help them get connected with the like minding folks around the globe.

Meetups It is an Platform for people to help them get connected with the like minded folks around the globe. Live on Web: Cick here ?? Meet and Connec

Hardik Kaushik 5 Apr 26, 2022
This is a simple Wrapper around the ZipArchive methods with some handy functions

Note I haven't updated this package in a long time except merging PRs. The last time I was using this package was with PHP5. I archived the repository

Nils Plaschke 845 Dec 13, 2022
This is a simple Wrapper around the ZipArchive methods with some handy functions

Note I haven't updated this package in a long time except merging PRs. The last time I was using this package was with PHP5. I archived the repository

Nils Plaschke 836 Jan 26, 2022
A wrapper around faker for factory muffin

Factory Muffin Faker 2.3 The goal of this package is to wrap Faker to make it super easy to use with Factory Muffin. Note that this library does not a

The League of Extraordinary Packages 36 Nov 29, 2022
An object oriented wrapper around PHP's built-in server.

Statix Server Requirements PHP 8 minumum Installation composer require statix/server Basic Usage To get started, ensure the vendor autoload script is

Statix PHP 113 Dec 27, 2022
A PHP wrapper around Libreoffice for converting documents from one format to another.

Document Converter A PHP wrapper around Libreoffice for converting documents from one format to another. For example: Microsoft Word to PDF OpenOffice

Lukas White 0 Jul 28, 2022
A simple wrapper around vlucas' PHP dotenv library for Kirby CMS.

kirby-phpdotenv A simple wrapper around vlucas' PHP dotenv library for Kirby CMS. Why? I've been using .env in my Kirby projects for a while, but I go

Steve Jamesson 5 Feb 6, 2020