micropackage/casegnostic

Casegnostic - access properties and methods both snake_case and camelCase

1.0.0 2022-11-28 13:47 UTC

This package is auto-updated.

Last update: 2024-11-27 18:52:53 UTC


README

BracketSpace Micropackage Latest Stable Version PHP from Packagist Total Downloads License

Micropackage logo

🧬 About Casegnostic

Package that simplifies transition from one coding standard to other, namely from snake_case to camelCase or vice-versa.

When you're about to break compatibility by changing method name from something_important() to somethingImportant() you can simply attach the trait.

use Micropackage\Casegnostic\Casegnostic;

class Example
{
	use Casegnostic;

	public function somethingImportant()
	{
		return true;
	}
}

$x = new Example();

// That works as expected:
$x->somethingImportant();

// But that works too! 🤯
$x->something_important();

💾 Installation

composer require micropackage/casegnostic

🕹 Usage

Simply attach the trait to your class.

use Micropackage\Casegnostic\Casegnostic;

class Example
{
	use Casegnostic;
}

📦 About the Micropackage project

Micropackages - as the name suggests - are micro packages with a tiny bit of reusable code, helpful particularly in WordPress development.

The aim is to have multiple packages which can be put together to create something bigger by defining only the structure.

Micropackages are maintained by BracketSpace.

📖 Changelog

See the changelog file.

📃 License

GNU General Public License (GPL) v3.0. See the LICENSE file for more information.