I am trying to wrap my head around the namespaces, autoloaders and FIG standards and most importantly how to achieve their integration to WordPress as close as possible.
Here is my file structure, created with help of awesome roots/bedrock WordPress stack.
|-- /web
| |-- /app
| | |-- /mu-plugins
| | | |-- autoload.php
| | | |-- /cibulka-mu-base // abstract classes, traits, ... for features
| | | |-- /cibulka-mu-feature-1 // features as custom post types, theme support, forms, ...
| | | |-- /cibulka-mu-feature-2 // features as custom post types, theme support, forms, ...
| | |-- /themes
| | | |-- /cibulka-parent-theme
| | | | |-- functions.php // plays with MU plugins, sets default config
| | | |-- /cibulka-child-theme
| | | | |-- functions.php // plays with MU plugins, overrides default config
| | |-- /plugins
| | | |-- /akismet
| | | |-- /other third party software
| |-- /wp
| | |-- /wp-admin
| | |-- /wp-includes
| | |-- etc.
How to mimic the file structure by namespaces and in the same time, by as much FIG-friendly as possible? In the same time, “the packages” of “the app” should be stored in separate folders, so they can be required by composer.json
files and monitored by GIT.
I’ve tried a lot of options, but to be honest, I am little overwhelmed by the number of possible solutions and by the fact, that none of them is very ideal.
Can you tell me what was useful in your cases?
Edit: Possible routes
- fully following the directory structure:
web\app\muPlugins\CibulkaMuBase
etc. - “faking” vendor directory:
cibulka\MU\Base
,cibulka\themes\parentTheme
, … - further manipulation of WP directory structure – limited options, complicating pretty much everything else, bad compatibility, …
- anything more clever?