michaelcozzolino/php-redefinitions

Provides a GitHub repository template for a PHP package with GitHub Actions workflows using standard PHP development tools.

v0.1.0 2024-11-17 10:58 UTC

This package is auto-updated.

Last update: 2024-11-17 10:59:25 UTC


README

This package provides a set of redefinitions of native php functions so that they can be mocked in unit tests.

Installation

Run

composer require michaelcozzolino/php-redefinitions

Usage

Every redefinition is included in a specific class whose name is {category}Redefinition where the category is the name specified in the title where the related functions are documented in php. E.G:

if we go to https://www.php.net/manual/en/ref.json.php, we see JSON Functions, so this means that the redefinitions of these functions will be in a class called JsonRedefinition, to notice the PascalCase even if the word JSON is uppercase. So you can find the needed class and inject it in your application.