All Projects → wordplate → Wordplate

wordplate / Wordplate

Licence: mit
WordPlate is a wrapper around WordPress. It's like building any other WordPress website with themes and plugins. Just with sprinkles on top.

Programming Languages

PHP
23972 projects - #3 most used programming language
javascript
184084 projects - #8 most used programming language
shell
77523 projects
CSS
56736 projects

Projects that are alternatives of or similar to Wordplate

Wp Multitenancy Boilerplate
WordPress multitenancy boilerplate configured and managed with Composer and PHP dotenv.
Stars: ✭ 24 (-98.49%)
Mutual labels:  wordpress, composer, boilerplate
Composify
Turn WordPress plugin zip files into git repositories, so that composer version constraints work properly.
Stars: ✭ 36 (-97.74%)
Mutual labels:  wordpress, composer
Wp Vuejs
WordPress VueJS Starter Theme
Stars: ✭ 19 (-98.81%)
Mutual labels:  wordpress, boilerplate
Docker Skeleton Php
A simple Docker PHP development environment
Stars: ✭ 40 (-97.49%)
Mutual labels:  composer, boilerplate
Wordpress
A fork of WordPress with Composer support added. Branches, tags, and trunk synced from upstream every 15 minutes.
Stars: ✭ 546 (-65.75%)
Mutual labels:  wordpress, composer
Wpackagist
WordPress Packagist — manage your plugins with Composer
Stars: ✭ 558 (-64.99%)
Mutual labels:  wordpress, composer
Heroku Wp
WordPress on Heroku
Stars: ✭ 865 (-45.73%)
Mutual labels:  wordpress, composer
Project
⭐️ Antares Project Application Skeleton. This is the very first place you should start. It allows you to create a brand new awesome project in easy few steps.
Stars: ✭ 84 (-94.73%)
Mutual labels:  composer, boilerplate
Spinupwp Composer Site
A WordPress site setup using Composer that is primed and ready to be hosted using SpinupWP.
Stars: ✭ 58 (-96.36%)
Mutual labels:  wordpress, composer
Generator Dhboilerplate
Boilerplate made by David Hellmann
Stars: ✭ 54 (-96.61%)
Mutual labels:  wordpress, boilerplate
Acf Builder
An Advanced Custom Field Configuration Builder
Stars: ✭ 492 (-69.13%)
Mutual labels:  wordpress, composer
Beetbox
Pre-provisioned L*MP stack
Stars: ✭ 94 (-94.1%)
Mutual labels:  wordpress, composer
Wordpress Plugin Boilerplate Powered
Wordpress Plugin Boilerplate but Powered with examples and a generator!
Stars: ✭ 413 (-74.09%)
Mutual labels:  wordpress, boilerplate
Bedrock
WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure
Stars: ✭ 5,456 (+242.28%)
Mutual labels:  wordpress, composer
Awps
A Modern WordPress Starter Theme for savvy Developers
Stars: ✭ 319 (-79.99%)
Mutual labels:  wordpress, composer
Wp Reactivate
React boilerplate for WordPress plugins
Stars: ✭ 303 (-80.99%)
Mutual labels:  wordpress, boilerplate
Acf Pro Installer
A composer install helper for Advanced Custom Fields PRO
Stars: ✭ 265 (-83.38%)
Mutual labels:  wordpress, composer
Mozart
Developers tool for WordPress plugins: Wraps all your projects dependencies in your own namespace, in order to prevent conflicts with other plugins loading the same dependencies in different versions.
Stars: ✭ 277 (-82.62%)
Mutual labels:  wordpress, composer
Generator Baukasten
Awesome!
Stars: ✭ 50 (-96.86%)
Mutual labels:  wordpress, boilerplate
Wordpress
Automatically updated WordPress composer package
Stars: ✭ 94 (-94.1%)
Mutual labels:  wordpress, composer

WordPlate

WordPlate

WordPlate is a wrapper around WordPress. It's 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.4+ 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": "^10.0",
    "wpackagist-plugin/hide-updates": "^1.1"
},

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

If you want to use Vite.js with WordPlate, see our setup guide in the FAQ section.

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.

  • Clean UI

    The plugin takes control over the administration dashboard.

  • 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 9 to 10
  1. WordPlate now requires PHP 7.4 or later.

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

  3. Rename WP_ENV to WP_ENVIRONMENT_TYPE in the environment file.

  4. Rename WP_THEME to WP_DEFAULT_THEME in the environment file.

  5. Rename WP_URL to WP_HOME in the environment file (if it exists).

  6. If you're using the WP_CACHE environment variable you'll need to define it in the public/wp-config.php file:

    $application->run();
    
    +define('WP_CACHE', env('WP_CACHE', false));
    
    $table_prefix = env('DB_TABLE_PREFIX', 'wp_');
  7. Optional: Rename WP_PREFIX to DB_TABLE_PREFIX in the following files:

    • .env
    • .env.example
    • public/wp-config.php
  8. Run composer update in the root of your project.

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.

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.

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.

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.

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.

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_DEFAULT_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:

<?php

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;
    }
}
Can I use WordPlate with Vite.js?
  1. It is possible to use Vite.js with WordPlate. First you'll need to replace the contents of the package.json file:

    {
        "private": true,
        "scripts": {
            "build": "vite build",
            "dev": "vite"
        },
        "dependencies": {
            "dotenv": "^10.0.0",
            "vite": "^2.6.14"
        }
    }
  2. Remove the webpack.mix.js file from the root of your project.

  3. Add a new file called vite.config.js in the root of your project and add the following script:

    require('dotenv').config();
    
    export default ({ command }) => ({
      base: command === 'serve' ? '/' : '/build/',
      publicDir: 'resources/static',
      build: {
        manifest: true,
        outDir: `public/themes/${process.env.WP_DEFAULT_THEME}/assets`,
        assetsDir: '',
        rollupOptions: {
          input: 'resources/scripts/index.js',
        },
      },
      plugins: [
          {
            name: 'php',
            handleHotUpdate({ file, server }) {
              if (file.endsWith('.php')) {
              server.ws.send({
                type: 'full-reload',
                path: '*',
              });
              }
            },
        },
      ],
    });
  4. Remove the <script> tag from the footer.php file:

    -<script src="<?= get_theme_file_uri('assets/index.js') ?>" async></script>
  5. Remove the <link> stylesheet tag from the header.php file:

    -<link rel="stylesheet" href="<?= get_theme_file_uri('assets/index.css') ?>">
  6. Add the Vite.js <script> and <link> assets between the <head> tags in the header.php file:

    <?php if (
        wp_get_environment_type() === 'local' &&
        is_array(wp_remote_get('http://localhost:3000'))
    ) : ?>
        <script type="module" src="http://localhost:3000/@vite/client"></script>
        <script type="module" src="http://localhost:3000/resources/scripts/index.js"></script>
    <?php else : ?>
        <?php $manifest = json_decode(file_get_contents(get_theme_file_path('assets/manifest.json')), true); ?>
        <script type="module" src="<?= get_theme_file_uri('assets/' . $manifest['resources/scripts/index.js']['file']) ?>" defer></script>
        <link rel="stylesheet" href="<?= get_theme_file_uri('assets/' . $manifest['resources/scripts/index.js']['css'][0]) ?>">
    <?php endif; ?>
  7. Import the index.css file in the resources/scripts/index.js file:

    +import '../styles/index.css';
  8. Move any static files such as fonts and images into the resources/static directory.

  9. Run npm install and then npm run dev to start the development server.

Acknowledgements

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].