PLEASE report all issues to our YouTrack System.
This package helps to set up a project with the following tools:
- Composer Packages
- PHP CS Fixer (for automatic code styling fixes)
- PHP Linter (for syntax checking)
- PHP Mess Detector (detect code smells and possible errors within the analyzed source code)
- PHPStan (static analyzer that examines code and looks for issues)
- Pest (unit/feature testing framework)
- a
.node-versionfile which sets the basenodeversion for your project (useful for fnm) - GitHub action workflow for automatic scanning on pushes/pull requests
- a
Makefileto assist in running build and scanning commands in a consistent and simple manner - installation to a
gitpre-commit hook that will automatically run thecs-fixer,linterandphpstan
Here is the current recipe versions being used for each library:
| Library | Symfony Recipe Version | | PHPUnit | 9.6 | | php-cs-fixer | 3.0 | | phpstan | Modified to low entry (from 1.0) |
Zeek.Build.Process.-.Demo.mp4
If you have ANY Private repositories in your project you will need to create COMPOSER_AUTH_JSON as a GitHub secret for the repository. (You will want to have this on the repo that uses this library)
This works with both Laravel, WordPress and Symfony projects*.
WordPress project structure must follow the Zeek project structure (mu-plugins/app/).
Symfony project structure follows Symfony Standards, and expecting you are using Symfony Flex with the Recipes and Contrib Recipes.
Require this package as a dev dependency:
composer require --dev zeek/zeek-build-processInstall by running (assuming your vendor path is /vendor):
./vendor/bin/zbp installThis performs a safe, no-clobber installation into an existing project. It does so in an idempotent manner: if you run the installation, make some changes to one of the configuration files and then run the installation again, it will not overwrite your changes.
If you need to forcefully reinstall and start everything over from scratch you can run:
./vendor/bin/zbp reinstallBe warned this will overwrite any changes you've made as well as any baselines you've created.
If you'd like to completely remove all the tools, files and packages that this installs, you can run
./vendor/bin/zbp uninstallIf you just need to set up your own local git pre-commit hook, you can simply run:
./vendor/bin/zbp precommitThis will create a .git/hooks/pre-commit file that runs the make precommit command immediately before the actual git commit happens.
A Makefile is installed that defines the commands (with configured flags/parameters) to utilize the tools in an easy and repeatable manner.
You can examine the Makefile source to really see what it's doing.
Useful aliases:
Runs cs-fixer and lint:
make precommitRuns cs-fixer, lint, phpstan and phpmd:
make scanUseful individual commands:
make cs-fixermake lintmake phpmdmake phpstanmake pestIf you've just installed and need to baseline your project so that the build system only looks at new code:
make baselineIf you want to run a specific tool baseline
make phpmd-baselinemake phpstan-baselineUpon installation, a pre-commit hook is created in .git/hooks/pre-commit. This hook runs immediately before you commit code.
It runs the make precommit alias, and will cause the commit to error out if any major problems are detected.
You should run make scan on your own, as it includes the phpmd tool which attempts to give you guidance on good practices.
You can bypass the pre-commit hook by passing --no-verify to the commit command. This should be used sparingly and only when necessary.
A standardized GitHub action build.yml file is included which will do all the steps necessary to run the scan commands on every push to GitHub.
This build file will automatically review your code and pull requests and give feedback. You should attempt to fix whatever issues are reported, however this system is still in an experimental stage and it may report things that be irrelevant. If you have any questions please contact Aaron Holbrook.
It is completely possible to tweak the tool configurations for your individual project. A build folder is created upon the initial installation.
Each tool has its own directory and configuration file. To tweak the individual file you will have to read the appropriate tool's documentation and see what works best.