PHPackages                             vinkla/wordplate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. vinkla/wordplate

ActiveProject

vinkla/wordplate
================

The WordPlate boilerplate

12.10.2(1mo ago)2.2k5.1k↑200%157MITPHPPHP ^8.4CI passing

Since Mar 18Pushed 1mo ago46 watchersCompare

[ Source](https://github.com/vinkla/wordplate)[ Packagist](https://packagist.org/packages/vinkla/wordplate)[ RSS](/packages/vinkla-wordplate/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (16)Versions (128)Used By (0)

[![WordPlate](https://private-user-images.githubusercontent.com/499192/321608036-a6194bed-09c0-418e-8281-2541922aa5f0.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ0MzU0NDksIm5iZiI6MTc3NDQzNTE0OSwicGF0aCI6Ii80OTkxOTIvMzIxNjA4MDM2LWE2MTk0YmVkLTA5YzAtNDE4ZS04MjgxLTI1NDE5MjJhYTVmMC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMzI1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDMyNVQxMDM5MDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mODAxMTdiMTc4NWY1OWI4ZWE5YWRhNmVkM2M1NDc4ZWE5YWI3MWMzMDBkZDMwYTZiODM4ODkzM2Q4ZWI5MDlhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.69ftIx_UzhEgTjFYcwimmiB2Sh5k_-5vrkOjeVecOxo)](https://private-user-images.githubusercontent.com/499192/321608036-a6194bed-09c0-418e-8281-2541922aa5f0.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ0MzU0NDksIm5iZiI6MTc3NDQzNTE0OSwicGF0aCI6Ii80OTkxOTIvMzIxNjA4MDM2LWE2MTk0YmVkLTA5YzAtNDE4ZS04MjgxLTI1NDE5MjJhYTVmMC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMzI1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDMyNVQxMDM5MDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mODAxMTdiMTc4NWY1OWI4ZWE5YWRhNmVkM2M1NDc4ZWE5YWI3MWMzMDBkZDMwYTZiODM4ODkzM2Q4ZWI5MDlhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.69ftIx_UzhEgTjFYcwimmiB2Sh5k_-5vrkOjeVecOxo)

WordPlate
=========

[](#wordplate)

WordPlate is a boilerplate for WordPress, built with Composer and designed with sensible defaults.

[![Build Status](https://camo.githubusercontent.com/2597dcf4899bae8e677dfae9e67c73c697d7937261fabc5c6eaa34994a9641e7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f76696e6b6c612f776f7264706c6174652f7068702d63732d66697865722e796d6c3f6c6162656c3d7465737473266c6f676f)](https://github.com/vinkla/wordplate/actions)[![Monthly Downloads](https://camo.githubusercontent.com/a7b3f2a1abcd8e16ac80ae8c8f1858c0d66d76c2b93fd257cd7d69fbf9477858/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f76696e6b6c612f776f7264706c617465)](https://packagist.org/packages/vinkla/wordplate/stats)[![Latest Version](https://camo.githubusercontent.com/e2069711f1a3510bebac82ec8da4f67867e97bc4316d18aee49bc66f7d5f1a48/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76696e6b6c612f776f7264706c617465)](https://packagist.org/packages/vinkla/wordplate)

- [Features](#features)
- [Installation](#installation)
- [Configuration](#configuration)
    - [Public Directory](#public-directory)
    - [Environment Configuration](#environment-configuration)
    - [Salt Keys](#salt-keys)
- [Plugins](#plugins)
    - [WP Packages](#wp-packages)
    - [Must Use Plugins](#must-use-plugins)
    - [Included Plugins](#included-plugins)
- [Vite.js](#vitejs)
- [Mail](#mail)
- [FAQ](#faq)
- [Upgrade Guide](#upgrade-guide)
- [Acknowledgements](#acknowledgements)
- [License](#license)

Features
--------

[](#features)

- **WordPress + Composer = ❤️**

    WordPress can be installed and updated with ease using Composer. To update WordPress, simply run the command `composer update`.
- **Environment Files**

    Similar to Laravel, WordPlate stores environment variables, such as database credentials, in an `.env` file.
- **WP Packages**

    WP Packages enables the management of WordPress plugins and themes through Composer.
- **Must-use plugins**

    Don't worry about clients deactivating plugins; [must-use plugins](https://developer.wordpress.org/advanced-administration/plugins/mu-plugins/) are enabled by default.
- **Vite.js**

    Using Vite, you can rapidly set up and begin building and minifying your CSS and JavaScript.
- **Tailwind CSS**

    Tailwind CSS is included by default, allowing you to quickly build custom designs.
- **Debugging**

    Familiar debugging helper functions are integrated such as `dump()` and `dd()`.
- **Clean UI**

    Enhance the WordPress dashboard and improves the [user experience](https://user-images.githubusercontent.com/499192/143415951-b01e9498-5f18-44dd-9d4b-51fb2d479a22.png) for clients.

Installation
------------

[](#installation)

Before using WordPlate, make sure you have PHP 8.4 and MySQL 8.0 installed on your computer. You'll also need to have Composer, a package manager for PHP, installed on your computer.

To install WordPlate, open your terminal and enter the following command:

```
composer create-project --prefer-dist vinkla/wordplate example-app
```

After installing WordPlate, you'll need to update the database credentials in the `.env` file. This file is located in the root directory of your project. Open the file and update the following lines with your database credentials:

```
DB_NAME=database
DB_USER=username
DB_PASSWORD=password
```

To run your WordPlate application, you may serve it using PHP's built-in web server. Open your terminal and navigate to the `public` directory of your project. Then, enter the following command:

```
php -S 127.0.0.1:8000 -t public/
```

Finally, open your web browser and visit the following URLs to view your WordPlate application:

- [`http://127.0.0.1:8000/`](http://127.0.0.1:8000/) - Your website
- [`http://127.0.0.1:8000/wordpress/wp-admin`](http://127.0.0.1:8000/wordpress/wp-admin) - The dashboard

Configuration
-------------

[](#configuration)

### Public Directory

[](#public-directory)

After installing WordPlate, you'll need to configure your web server's document or web root to be the `public` directory. This is where the main entry point for your application, `index.php`, is located.

By setting the `public` directory as your web server's document root, you ensure that all HTTP requests are routed through the front controller, which handles the requests and returns the appropriate responses.

This configuration helps to improve the security and performance of your application by preventing direct access to files outside of the `public` directory.

### Environment Configuration

[](#environment-configuration)

WordPlate makes it easy to manage different configuration values based on the environment where your application is running. For example, you may need to use a different database locally than you do on your production server.

To accomplish this, WordPlate uses the [`vlucas/phpdotenv`](https://github.com/vlucas/phpdotenv) PHP package. When you install WordPlate, a `.env.example` file is included in the root directory of your application. If you installed WordPlate via Composer, this file will automatically be renamed to `.env`. Otherwise, you should rename the file manually.

It's important to note that your `.env` file should not be committed to your application's source control. This is because each developer or server using your application may require a different environment configuration. Additionally, committing your `.env` file to source control would be a security risk in the event that an intruder gains access to your repository, as any sensitive credentials would be exposed.

To learn more about managing environment variables in WordPlate, you can refer to Laravel's documentation on the topic:

- [Environment Variable Types](https://laravel.com/docs/13.x/configuration#environment-variable-types)
- [Retrieving Environment Configuration](https://laravel.com/docs/13.x/configuration#retrieving-environment-configuration)

### Salt Keys

[](#salt-keys)

It's important to add salt keys to your environment file. These keys are used to encrypt sensitive data, such as user sessions, and help to ensure the security of your application.

If you don't set the salt keys, your user sessions and other encrypted data may be vulnerable to attacks. To make it easier to generate secure salt keys, we've created a [salt key generator](https://vinkla.github.io/salts/) that you can use. If you haven't already done so, copy the `.env.example` file to a new file named `.env`. Then visit the generator and copy the randomly generated keys to your `.env` file.

Plugins
-------

[](#plugins)

### WP Packages

[](#wp-packages)

WordPlate includes integration with [WP Packages](https://wp-packages.org), a Composer repository that mirrors the WordPress plugin and theme directories. With this integration, you can install and manage plugins using Composer.

To install a plugin, use `wp-plugin` as the vendor name and the plugin slug as the package name. For example, to install the `clean-image-filenames` plugin, you would use the following command:

```
composer require wp-plugin/clean-image-filenames
```

The installed packages will be located in the `public/plugins` directory.

Here's an example of what your `composer.json` file might look like:

```
"require": {
    "wp-plugin/clean-image-filenames": "^1.5"
}
```

For more information and examples, please visit the [WP Packages website](https://wp-packages.org).

### Must Use Plugins

[](#must-use-plugins)

[Must-use plugins](https://developer.wordpress.org/advanced-administration/plugins/mu-plugins/) (also known as mu-plugins) are a type of WordPress plugin that is installed in a special directory inside the content folder. These plugins are automatically enabled on all sites in the WordPress installation.

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

```
"installer-paths": {
    "public/mu-plugins/{$name}": [
        "type:wordpress-muplugin",
        "wp-plugin/clean-image-filenames",
    ]
}
```

To install the plugin, use `wp-plugin` as the vendor name and the plugin slug as the package name:

```
composer require wp-plugin/clean-image-filenames
```

The plugin will be installed in the `public/mu-plugins` directory.

For more information on the must-use plugin autoloader, please refer to the [Bedrock documentation](https://roots.io/bedrock/docs/mu-plugin-autoloader/).

### Included Plugins

[](#included-plugins)

#### [Headache](https://github.com/vinkla/headache)

[](#headache)

An easy-to-swallow painkiller plugin for WordPress. The plugin removes a lot of default WordPress stuff you just can't wait to get rid of. It removes meta tags such as feeds, version numbers and emojis.

- Disables XML-RPC and protects against user enumeration
- Removes feeds, emoji scripts, oEmbed, and block styles
- Disables attachment pages and randomizes media slugs
- Prevents indexing on non-production environments

#### [Clean Image Filenames](https://wordpress.org/plugins/clean-image-filenames/)

[](#clean-image-filenames)

The plugin automatically converts language accent characters in filenames when uploading to the media library. Characters are converted into browser and server friendly, non-accent characters.

- `Räksmörgås.jpg` → `raksmorgas.jpg`
- `Æblegrød_FTW!.gif` → `aeblegrod-ftw.gif`
- `Château de Ferrières.png` → `chateau-de-ferrieres.png`

Vite.js
-------

[](#vitejs)

[Vite](https://vitejs.dev/) is a build tool that provides a faster and leaner development experience for modern web projects. It comes with sensible defaults and is highly extensible via its Plugin and JavaScript APIs with full typing support.

```
# Start the dev server...
npm run dev

# Build for production...
npm run build
```

[Learn more about Vite's backend integration.](https://vitejs.dev/guide/backend-integration.html)

Mail
----

[](#mail)

To set up custom SMTP credentials for sending emails in your WordPlate application, you need to configure the required environment variables in your `.env` file.

```
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="Example"
```

If you're using a local email service like Mailhog or Mailpit, you need to disable encryption by setting the `MAIL_ENCRYPTION` environment variable to `null`.

FAQ
---

[](#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.

```
define('WP_DISABLE_FATAL_ERROR_HANDLER', env('WP_DISABLE_FATAL_ERROR_HANDLER', false));

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

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

```
WP_DEFAULT_THEME=wordplate
+WP_ALLOW_MULTISITE=true
```

**Can I disable WP-Cron and set up a manual cron job?**WordPlate allows you to disable the internal WordPress cron system via the `DISABLE_WP_CRON` environment variable:

```
DISABLE_WP_CRON=true
```

It is recommended to manually set a cron job if you enable this setting and disable the WordPress cron. You'll need to add the following in your crontab file:

```
*/5 * * * * curl https://exempel.se/wordpress/wp-cron.php
```

**Can I install languages with Composer?**If you want to install language packs using Composer, we recommend looking at the [WP Languages](https://wp-languages.github.io/) project. Below is an example of a `composer.json` file that installs the Swedish language pack for WordPress.

```
{
    "require": {
        "koodimonni-language/core-sv_se": "*",
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://wp-languages.github.io",
            "only": [
                "koodimonni-language/*"
            ]
        }
    ],
    "config": {
        "allow-plugins": {
            "koodimonni/composer-dropin-installer": true
        },
    },
    "extra": {
        "dropin-paths": {
            "public/languages/": [
                "vendor:koodimonni-language"
            ]
        }
    }
}
```

**Can I rename the public directory?**Update your `.gitignore`, `composer.json`, `vite.config.js`, and `wp-cli.yml` files with the new path to the `public` directory. Then, run `composer update` in the root of your project.

**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 Herd?**If you're using Laravel Herd or Valet together with WordPlate, you may use our [custom driver](https://herd.laravel.com/docs/macos/extending-herd/custom-drivers):

```
