Tool for generating common WordPress code from structured spec file.
Why not? DRY - Don't repeat yourself
Requirements are defined by the requirements of default adapters.
- PHP 7.0
- WordPress 4.8
- Composer
Do you need to work with earlier versions of PHP or WordPress? It is possible to implement adapters with lower requirements.
- add wp-spec2code as a composer dependency
- create spec file
- run wp s2c gen
- include s2c/vendor/autoload.php
- init by Bootstrap::boot()
- carry on with the rest of your project
- target folder (default s2c)
- namespace (default none)
- I18N domain (default wordpress)
- post types - https://codex.wordpress.org/Function_Reference/register_post_type
- taxonomies - https://codex.wordpress.org/Function_Reference/register_taxonomy
- post meta fields
- taxonomy meta fields
- native WordPress, ACF, metaxbox.io...
- Create WP CLI command to trigger the (re-)generation of code
- Review sample config file + document it (perhaps using something like JSON schema or https://blog.picnic.nl/how-to-use-yaml-schema-to-validate-your-yaml-files-c82c049c2097)
- CPT code generation
- CT code generation
- Simple text metabox generation
- Deploy to packagist
- https://github.com/awurth/PHP-Config (PHP, JSON, YAML)
- https://symfony.com/doc/current/components/yaml.html (YAML only)
- https://github.com/nette/php-generator
- http://memio.github.io/memio/
- code generator used by https://github.com/phpro/soap-client
- create config file from existing WordPress installation
- allow adapters to register themselves with factories
- options for inclusion of third party composer dependencies required by adapters
- add as a part of generated composer.json file in target folder
- add to an existing compose.json file (in the root of your context or defined file as script argument)
- print the required dependencies to the console (or composer require commands)