zippovich2 / wordpress
Developing Wordpress app in modern way using composer.
Installs: 20
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:project
Requires
- php: ^7.3
- roots/wordpress: ^5.0
- symfony/dotenv: ^5.0
- zippovich2/wordpress-config: ^1.1
- zippovich2/wordpress-loader: ^1.1
Requires (Dev)
- aaemnnosttv/wp-cli-dotenv-command: ^2.0
- friendsofphp/php-cs-fixer: ^2.16
- phpunit/phpunit: ^9.0
- symfony/css-selector: ^5.0
- symfony/dom-crawler: ^5.0
- symfony/http-client: ^5.1
- symfony/var-dumper: ^5.0
- wp-cli/wp-cli-bundle: ^2.3
Conflicts
- zippovich2/wordpress-config: <1.1.3
- zippovich2/wordpress-loader: <1.1.1
This package is auto-updated.
Last update: 2024-10-27 23:12:25 UTC
README
Developing Wordpress app in modern way using composer.
Features
- Better folder structure.
- Dependency management with Composer.
- Easy WordPress configuration with environment specific files.
- Environment variables with Symfony Dotenv.
- Filters and actions configuration in .yaml files.
Requirements
- Docker
or
- PHP >= 7.3
- Composer - Install
- MySql
- Nginx or Apache2
Installation
-
Create a new project:
$ composer create-project zippovich2/wordpress project-name
-
Update variables in the
.env
files and constants in the.const
files (you can use.env
,.env.local
,.env.dev
,.env.dev.local
and.const
,.const.local
,.const.dev
,.const.dev.local
files depends on yourAPP_ENV
):APP_ENV
- set to environment (dev
,prod
ortest
).DB_TABLE_PREFIX
- use this environment variable to change database table prefix, default iswp_
.- Database constants:
DB_NAME
- database name.DB_USER
- database user.DB_PASSWORD
- database password.DB_HOST
- database host.
WP_HOME
- full URL to WordPress home (https://example.com).WP_SITEURL
- full URL to WordPress including subdirectory (https://example.com/wp).- Wordpress salts will be generated after the project is created (if you used
composer create-project
), but you can regenerate them:composer salts
make salts
wp dotenv salts regenerate --file=.env
- or generate with roots WordPress salts generator
-
Add a theme(s) in
public/app/themes/
as you would for a normal WordPress site -
Set the document root on your webserver to
public
folder:/path/to/site/public/
-
Access WordPress admin at
https://example.com/wp/wp-admin/
-
For enabling WordPress Config - add to begin of
functions.php
:use WordpressWrapper\Config\Config; $config = new Config($_ENV['PROJECT_ROOT'] . '/config'); $config->load();
If you are using Docker - you can skip 3, 4 and 5, just run make up
or docker-compose up
then you can access you site by
uri http://localhost:8080
.
Folder structure
your-project/
├─ .docker/
├─ config/
| └─ ...
├─ public/
| ├─ app/
| ├─ wp/
| ├─ index.php
| └─ wp-config.php
├─ src/
| └─ ...
├─ var/
├─ tests/
└─ vendor/
.docker/
- contain files which are used to build docker environment, you can delete this folder if run app without Docker.config/
- contain .yaml config files, at this moment WordPress Wrapper Config support:filters.yaml
actions.yaml
public/
- this is root folder, contain:app/
- same as defaultwp-content
WordPress folder.wp/
- contain WordPress core, you should not edit files from this directory.index.php
- WordPress core loads here.wp-config.php
- here.env*
and.const*
files are load.
tests/
- app tests.var/
- contain docker data(if you use Docker) and logs.vendor/
- composer dependencies.