jeroendn / php-helpers
A package containing classes and scripts to use across multiple projects.
Requires
- php: ^8.5
- ext-curl: *
- symfony/var-dumper: ^8.0
Requires (Dev)
- ergebnis/composer-normalize: ^2.52
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^13.2
- rector/rector: ^2.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-08-30 09:44:42 UTC
README
PHP helper classes and quality-tooling scripts to use across multiple projects.
Installation
composer require jeroendn/php-helpers
Contents
Classes
| Class | Purpose |
|---|---|
Helper\ArrayHelper |
Sort arrays of objects by one or more properties |
Helper\Casing |
Convert strings between snake_case, camelCase and PascalCase |
Helper\Debug |
Dump variables (raw, d, dd) |
Helper\Env |
Load .env variables into the server environment |
Wrapper\DateTime |
DateTime wrapper that can freeze into an immutable and back |
use jeroendn\PhpHelpers\Helper\ArrayHelper; $array = [ (object) ['name' => 'John'], (object) ['name' => 'Hans'], (object) ['name' => 'Piet'], ]; ArrayHelper::sortObjectsByProperty($array, 'name'); echo $array[0]->name; // Hans
Scripts
Code quality assurance
This package ships a whole-project quality gate to run before opening a PR. Composer links it into vendor/bin of every
project requiring this package:
vendor/bin/code-quality-assurance.sh
It runs composer normalize, composer validate, rector, php-cs-fixer, phpstan, phpunit and npm build — in that order,
aborting on the first failure. The tool steps run through the project's composer script definitions (rector-fix,
cs-fix, phpstan, phpunit), so a step only runs when the project defines the matching script — and that definition
controls the exact command, config and flags. The same script therefore serves projects with different setups.
Development
Day-to-day commands run inside the php_phphelpers container through the ./develop wrapper (develop.cmd makes the
same commands work from PowerShell/cmd on Windows):
./develop up -d --build # build + start the container ./develop checkout # composer install ./develop cqa # run the code quality assurance gate ./develop help # list all commands
Run tests
./develop composer phpunit