tsquare/classoverrider

Override PHP Classes using a path outside of your project, to make customizations that might otherwise be overwritten on an update.

1.0.0 2019-10-08 22:24 UTC

This package is auto-updated.

Last update: 2024-04-17 12:24:50 UTC


README

Allows the customization of code that would otherwise be unable to be modified without being possibly overwritten.

Specify an overrides directory outside of the projects codebase, where customized classes can be used instead.

The directory structure in the overrides path should emulate the overridden namespace, beyond the base namespace specified.

Example:

define('CLASSOVERRIDER_PATH', 'overrides_dir');
define('CLASSOVERRIDER_NS', 'Tsquare\\Overriding_Namespace');
define('CLASSOVERRIDER_BASE_NS', 'Tsquare\\Overridden_Namespace');

$foo = new MaybeOverride(Sample::class, 'arg1', 'arg2');