Skip to content

Commit

Permalink
feat(tool): ComposerRequireChecker (#29)
Browse files Browse the repository at this point in the history
* Add ComposerRequireChecker to the tool list

* fix(ComposerRequireChecker): PHP 8.1 support

---------

Co-authored-by: leocavalcante <lc@leocavalcante.com>
  • Loading branch information
flavioheleno and leocavalcante authored Mar 11, 2024
1 parent fab6372 commit 24f9bfb
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 17 deletions.
35 changes: 18 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,24 @@ phpctl sh echo 'Hello, World!' # To run arbitrary sh commands inside the contain
| `bundle` | Bundles a project into an image and ships it as a single binary file. |

### Tools
| Command | Description |
|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
| `box` | [Box](https://github.com/box-project/box): fast, zero config application bundler with PHARs. |
| `couscous` | [Couscous](https://github.com/CouscousPHP/Couscous): Couscous generates a GitHub pages website from your markdown documentation. |
| `exakat` | [Exakat](https://www.exakat.io) is a real time customizable static analyzer engine that analyse and fix code. |
| `frankenphp` | [FrankenPHP](https://frankenphp.dev): the Modern PHP App Server, written in Go. |
| `infection` | [Infection](https://infection.github.io) is a Mutation Testing Framework. |
| `pest` | [Pest](https://pestphp.com) is a testing framework with a focus on simplicity. |
| `php-cs-fixer` | [PHP Coding Standards Fixer (PHP CS Fixer)](https://cs.symfony.com/) fixes your code to follow standards. |
| `phpcbf` | [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) is an essential development tool that ensures your code remains clean and consistent. |
| `phpcs` | [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) is an essential development tool that ensures your code remains clean and consistent. |
| `phpmd` | [PHP Mess Detector](https://phpmd.org/) looks for several potential problems within your source code. |
| `phpstan` | [PHPStan](https://phpstan.org/) finds bugs in your code without writing tests. It's open-source and free. |
| `phpunit` | [PHPUnit](https://phpunit.de) is a programmer-oriented testing framework for PHP. |
| `pint` | [Pint](https://github.com/laravel/pint) is an opinionated PHP code style fixer for minimalists. |
| `rector` | [Rector](https://getrector.com) is a tool that you can run on any project to get an instant upgrade or automated refactoring. |
| `watchr` | [watchr](https://github.com/flavioheleno/watchr): command-line utility to explore and validate domain names and certificates. |
| Command | Description |
|----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `box` | [Box](https://github.com/box-project/box): fast, zero config application bundler with PHARs. |
| `composer-require-checker` | [ComposerRequireChecker](https://github.com/maglnet/ComposerRequireChecker): A CLI tool to analyze composer dependencies and verify that no unknown symbols are used in the sources of a package. |
| `couscous` | [Couscous](https://github.com/CouscousPHP/Couscous): Couscous generates a GitHub pages website from your markdown documentation. |
| `exakat` | [Exakat](https://www.exakat.io) is a real time customizable static analyzer engine that analyse and fix code. |
| `frankenphp` | [FrankenPHP](https://frankenphp.dev): the Modern PHP App Server, written in Go. |
| `infection` | [Infection](https://infection.github.io) is a Mutation Testing Framework. |
| `pest` | [Pest](https://pestphp.com) is a testing framework with a focus on simplicity. |
| `php-cs-fixer` | [PHP Coding Standards Fixer (PHP CS Fixer)](https://cs.symfony.com/) fixes your code to follow standards. |
| `phpcbf` | [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) is an essential development tool that ensures your code remains clean and consistent. |
| `phpcs` | [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) is an essential development tool that ensures your code remains clean and consistent. |
| `phpmd` | [PHP Mess Detector](https://phpmd.org/) looks for several potential problems within your source code. |
| `phpstan` | [PHPStan](https://phpstan.org/) finds bugs in your code without writing tests. It's open-source and free. |
| `phpunit` | [PHPUnit](https://phpunit.de) is a programmer-oriented testing framework for PHP. |
| `pint` | [Pint](https://github.com/laravel/pint) is an opinionated PHP code style fixer for minimalists. |
| `rector` | [Rector](https://getrector.com) is a tool that you can run on any project to get an instant upgrade or automated refactoring. |
| `watchr` | [watchr](https://github.com/flavioheleno/watchr): command-line utility to explore and validate domain names and certificates. |

### Scaffolders
| Command | Description |
Expand Down
2 changes: 2 additions & 0 deletions bin/composer-require-checker
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
phpctl composer-require-checker $@
11 changes: 11 additions & 0 deletions rootfs/usr/local/bin/install-tools
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ composer() {
chmod a+x /usr/local/bin/composer
}

composer_require_checker() {
local version="4.10.0"
if [ "$PHP_VERSION" = "81" ]; then
version="4.7.1"
fi
echo "Installing ComposerRequireChecker $version"
wget -q "https://github.com/maglnet/ComposerRequireChecker/releases/download/$version/composer-require-checker.phar" -O /usr/local/bin/composer-require-checker
chmod a+x /usr/local/bin/composer-require-checker
}

couscous() {
local version="1.10.0"
echo "Installing Couscous $version"
Expand Down Expand Up @@ -107,6 +117,7 @@ watchr() {
install() {
box
composer
composer_require_checker
couscous
[ -n "$WITH_EXAKAT" ] && exakat
infection
Expand Down
1 change: 1 addition & 0 deletions src/help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ help() {
echo -e ""
echo -e "\033[0;33mTools:\033[0m"
echo -e "\033[0;32m box \033[0m Runs Box (PHAR builder)"
echo -e "\033[0;32m composer-require-checker \033[0m Runs ComposerRequireChecker"
echo -e "\033[0;32m couscous \033[0m Runs Couscous"
echo -e "\033[0;32m exakat \033[0m Runs Exakat"
echo -e "\033[0;32m frankenphp \033[0m Runs FrankenPHP"
Expand Down
4 changes: 4 additions & 0 deletions src/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ box() {
fi;
}

composer-require-checker() {
run -- composer-require-checker ${@}
}

couscous() {
if [ -f vendor/bin/couscous ]; then
run -- vendor/bin/couscous ${@}
Expand Down
4 changes: 4 additions & 0 deletions tests/tools_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ function test_box() {
assert_matches "Box version 4\." "$(./bin/phpctl box --version)"
}

function test_composer_require_checker() {
assert_matches "ComposerRequireChecker 4\." "$(./bin/phpctl composer-require-checker --version)"
}

function test_couscous() {
assert_matches "Couscous 1\." "$(./bin/phpctl couscous --version)"
}
Expand Down

0 comments on commit 24f9bfb

Please sign in to comment.