Search by

jeroendn / php-helpers

jeroendn

A package containing classes and scripts to use across multiple projects.

Package info

github.com/jeroendn/PhpHelpers

pkg:composer/jeroendn/php-helpers

Statistics

Installs: 105

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.1.0 2026-07-30 09:27 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