Get your project dependencies by executing the following command.
yarn install && composer install
Start and initialize the Docker containers.
docker-compose up --build
Execute the provided bash script to automate WordPress installation and plugin activation.
For additional configuration and setup, modify the WP-CLI script found in docker/cli/install-wordpress
.
docker-compose run --rm cli install-wordpress
Admin Details
Username: wordpress
Password: wordpress
Compile your assets for production with the command:
npm run build
Compile your blocks for production with the command:
npm run build:blocks
Access the WP-CLI with the following commands:
docker-compose run --rm cli wp [command]
The Acorns package includes several Laravel Artisan commands. You can find a current list here.
docker-compose run --rm cli wp acorn [artisan:command]
You can load and set environment variables using a .env
file located in the src
directory. Rename .env.example
to .env
to get started. The file will be automatically loaded by the application.
Any environment variable files by default will be excluded from your package. Make sure to set default values or modify scripts/package.sh
to include *.env
files when packaging.
WordPress plugins sometimes encounter dependency namespace issues. To tackle this, it's advisable to prefix dependency namespaces with your own.
Note: Do not forget to compile your assets and blocks for production.
Use PHP-Scoper for this task. Install PHP-Scoper PHAR via Phive:
phive install humbug/php-scoper --force-accept-unsigned
Run PHP-Scoper to prefix dependency namespaces and export the plugin files to the build
folder.
composer prefix
Next, dump the Composer autoloader so everything works as expected.
composer dump-autoload --working-dir build --classmap-authoritative
Afterward, package the plugin for distribution:
npm run package