packagefactory / component-engine
Universal View Components for PHP
Requires
- php: >=8.2
Requires (Dev)
- packagefactory/grammar: ~0.10.0
- phpbench/phpbench: ^1.4
- phpstan/phpstan: ^2.1
- phpunit/php-code-coverage: ^11.0
- phpunit/phpunit: ^11.5
- squizlabs/php_codesniffer: ^3.7
This package is auto-updated.
Last update: 2025-11-02 18:53:16 UTC
README
Development
For common automated development tasks, the repository contains several scripts which can be run via:
./scripts/{script-name}
| script-name | description |
|---|---|
analyse | Run static code analysis with phpstan |
benchmark | Run benchmarks with phpbench |
build | Build LALR(1) parser files with PackageFactory.Grammar |
test | Run tests with phpunit |
Running tests
There's a test suite for unit tests and another one for grammar tests. By default only the unit test suite is run, because the grammar test suite is quite large and only needs to be run, if there have been changes to the grammar.
If you wish to run the grammar test suite separately, you can use:
./scripts/test --testsuite grammar
If you wish to run all tests, use:
./scripts/test --testsuite all
Running Benchmarks
When developing a performance-critical feature, you can track the performance impact by first taking a benchmark snapshot before starting development:
time ./scripts/benchmark --tag=before.my_feature --retry-threshold=5 --iterations=10
The --tag parameter instructs phpbench to save the snapshot under the identifier before.my_feature.
When your feature is finished, you can run the benchmarks again, while comparing them against the snapshot:
time ./scripts/benchmark --ref=before.my_feature --retry-threshold=5 --iterations=10
The --ref parameter instructs phpbench to compare the results with the given snapshot.
phpbench will highlight significant changes in performance. You need not worry about small percentage deltas, but significant drops (like +20%) are worth having a closer look at.
License
see LICENSE