Download the PHP package blacktrs/modern-wp without Composer
On this page you can find all versions of the php package blacktrs/modern-wp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download blacktrs/modern-wp
More information about blacktrs/modern-wp
Files in blacktrs/modern-wp
Package modern-wp
Short Description Symfony based WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure
License MIT
Homepage https://github.com/blacktrs/modern-wp
Informations about the package modern-wp
Overview
ModernWP is an enhanced WordPress boilerplate based on the pure Symfony Framework and Roots Bedrock.
ModernWP is created for WordPress-based projects that need better structure and tooling. You can use almost everything from Symfony and WordPress at the same time.
This boilerplate could be used for migrating big codebase from classic heavy WordPress-style projects to modern approaches without significant breaking loss of backward compatibility.
Features
- Symfony-driven structure project
- Easier configuration
- All benefits from the modern framework-based solution
- Roots Bedrock inside
Requirements
- PHP >= 8.1
- MySQL/MariaDB (due WordPress dependency)
Installation
composer create-project blacktrs/modern-wp ./project
cd ./project
composer install
yarn install
- Configure
DATABASE_URL
in.env
- Configure other needed env variables or yaml configs
Docker
- Copy
docker-compose.dist.yml
todocker-compose.yml
- Edit
docker-compose.yml
if needed - Run
docker-compose up -d --build
Potential docker issues
- If causes HTTP Error
500
afterbin/console cache:clear
removevar
directory and recreate it withchmod 0777
Local environment
- Open
https://localhost
Custom hostname
- Change
NGINX_HOST
with yours indocker-compose.yml
- Add entry
127.0.0.1 your_host.local
to/etc/hosts
Local HTTPS
- Install mkcert
- Run
mkcert -install
By default, https works for localhost
If needed to generate specific SSL certificate for your custom hostname run following command
- Change
your_host.local
with desired hostname - Update
docker-compose.yml
Documentation
Configuration
By default, configuration should be considered in confing/**.yaml
files.
The all configuration parameters in SCREAMING_SNAKE_CASE
will be converted to php const, so WordPress can read it as configuration constant.
For example, following parameters will be converted to PHP constant WP_DEBUG
with true
value.
More examples could be found in config/packages/app.yaml
Controller types
You can use 2 types of controllers:
- Rest API
- Template pages
Rest API Controllers
- Every Rest API Controller will be available by the address
https://your-site.com/api/controller/path
api
prefix can be changed in/config/packages/app.yml
in parameterapp.apiPrefix
Basically any non-template controller will be interpreted as Rest API controller. Examples could be found in src/Controller/Rest
directory
Template Controllers
- Every template controller will refer to the WordPress page address.
- To declare template controller, the
path
parameter ofRoute()
attribute should contain specific template name
For example, if needed controller for any page with a post-type page then declaring the route will look:
It is possible to declare a route for any WordPress template
More examples could be found in src/Controller/Frontent
directory
More documentation about controllers in symfony documentation
Templating
By default, templates should be in twig
format and stored int templates
directory. More details in symfony documentation
Hooks
Declarations of the new handlers for WordPress actions and filters are recommended to add in Kernel::registerHooks()
method
It is also recommended to use as a handler for every hook separate invokable service classes. To prevent Kernel class bloating it is better to store hook declarations as groups in the different classes.
Plugins
Plugins can be added from the WordPress admin dashboard or as Composer packages
Working with database
For convenient work with the database it is better to use Doctrine ORM
Out-of-the-box in src/Entity
are generated set of entities for default WP tables.
Boilerplate extending
To achieve deeper configuration please edit following files:
config/bootstrap.php
- bootstrap configurationpublic/app/mu-plugins/register-application-config.php
- boilerplate WordPress loaderpublic/app/themes/site-default/*
- default WP theme
Frontend assets
It is recommended to use Symfony Encore
and Symfony Asset
bundles to build and use frontend assets.
Compiled assets better to store in public
directory (e.g. public/build
)
Links
All versions of modern-wp with dependencies
composer/installers Version ^1.12
roots/bedrock-autoloader Version ^1.0
roots/bedrock-disallow-indexing Version ^2.0
roots/wordpress Version ^6.3
symfony/http-foundation Version ^6.3
symfony/cache Version ^6.3
ext-mysqli Version *
symfony/asset Version ^6.3
symfony/finder Version ^6.3
symfony/config Version ^6.3
symfony/routing Version ^6.3
symfony/dependency-injection Version ^6.3
symfony/dotenv Version ^6.3
symfony/yaml Version ^6.3
symfony/console Version ^6.3
symfony/http-kernel Version ^6.3
symfony/framework-bundle Version ^6.3
symfony/monolog-bundle Version ^3.8
symfony/flex Version ^2.2
doctrine/doctrine-bundle Version ^2.7
doctrine/doctrine-migrations-bundle Version ^3.2
doctrine/orm Version ^2.12
symfony/proxy-manager-bridge Version ^6.3
symfony/doctrine-messenger Version ^6.3
symfony/expression-language Version ^6.3
symfony/form Version ^6.3
symfony/http-client Version ^6.3
symfony/intl Version ^6.3
symfony/mailer Version ^6.3
symfony/mime Version ^6.3
symfony/notifier Version ^6.3
symfony/process Version ^6.3
symfony/security-bundle Version ^6.3
doctrine/annotations Version ^2.0
phpdocumentor/reflection-docblock Version ^5.3
phpstan/phpdoc-parser Version ^1.23
symfony/property-access Version ^6.3
symfony/property-info Version ^6.3
symfony/serializer Version ^6.3
symfony/string Version ^6.3
symfony/translation Version ^6.3
symfony/twig-bundle Version ^6.3
twig/extra-bundle Version ^2.12|^3.0
twig/twig Version ^2.12|^3.0
symfony/validator Version ^6.3
symfony/web-link Version ^6.3
symfony/webpack-encore-bundle Version ^1.17
blacktrs/symfony-wp-bundle Version ^1.1