A basic WordPress theme used to build WordPress websites and provide an easy workflow during development. Used by the WordPress team at Social Brothers and WPBrothers.
SB Gitbook »
SB CLI »
SB Composer »
🌱 Twig Docs ·
⚡️ Vite Docs ·
📦️ WP & composer ·
🟠 SB Vite ·
🔶 socialbrothers/wp-twig
-
PHP
^8.0|^8.1
- Composer
^2.3
- LocalWP|laravel/valet
- Composer
-
NodeJS
^16.16.0
yarn
ℹ️ Info: Composer
^2.3
is not a hard requirement but can large differences in versions can cause issues during deployment.
⚠️ Warning: PHP8.1
is currently unsupported by WPEngine as of 12-10-22.
With SB CLI
# Install with
yarn add @wpbrothers/sbcli -D
# Then to init a new project
sbcli init
ℹ️ Info: Read more about setting up a new project in our gitbook documentation.
A code style configuration for friendsofphp/php-cs-fixer
is included, defined in .php-cs-fixer.php
. By default,
it includes the PSR-1
and PSR-12
presets. You can customise or add rules in .php-cs-fixer.php
(although following
a single code style-standard is preferred).
To use php-cs-fixer
without having it necessarily installed globally, a composer script command is also included to
format php code using the provided config file and the vendor binary of php-cs-fixer
.
To format the projects php files, run the following command in {project_root}/app/public
:
# Run php-cs-fixer
composer format:php
# Run twig-cs-fixer
composer format:twig
# Run Both
composer format
ℹ️ Info https://mlocati.github.io/php-cs-fixer-configurator/#version:3.0 is a nifty tool to compose and export a custom code style configuration.
In your project root you will find a minimal .phpstorm.neon
file which is used to configure PHPStan (optional), this
is used to inform PHPStan that the directory app/public
should be considered the "project root".
Included with the package are a set of Unit tests using phpunit/phpunit
.
For ease of use a composer script command is
defined to run the tests.
The default configuration will be used when using the test
command, which is defined at .phpunit.xml
.
Run the following command in {project_root}/app/public
:
composer test
A code coverage report is generated in .cache/cov.xml
.