icanboogie/bind-prototype

Binds icanboogie/prototype to ICanBoogie.

v4.0.0 2018-03-18 02:47 UTC

README

Release Build Status Code Quality Code Coverage Packagist

The icanboogie/bind-prototype package binds icanboogie/prototype to ICanBoogie, using its Autoconfig feature. It provides a config synthesizer for prototype methods defined in hooks configuration fragments.

<?php

namespace ICanBoogie;

require 'vendor/autoload.php';

$app = boot();

$app->configs['prototype']; // obtain the "prototype" config.

Binding prototype methods using hooks config fragments

Using hooks configuration fragments, components may bind multiple prototype methods.

The following example demonstrates how an application may bind a url() method and a url property to instances of ActiveRecord:

<?php

// config/prototype.php

namespace App;

$hooks = Hooks::class . '::';

return [

	Article::class . '::url' => $hooks . '::url',
	Article::class . '::get_url' => $hooks . '::url'

];

Requirements

The package requires PHP 5.6 or later.

Installation

The recommended way to install this package is through Composer:

$ composer require icanboogie/bind-prototype

Cloning the repository

The package is available on GitHub, its repository can be cloned with the following command line:

$ git clone https://github.com/ICanBoogie/bind-prototype.git

Documentation

The package is documented as part of the ICanBoogie framework documentation. You can generate the documentation for the package and its dependencies with the make doc command. The documentation is generated in the build/docs directory. ApiGen is required. The directory can later be cleaned with the make clean command.

Testing

The test suite is ran with the make test command. PHPUnit and Composer need to be globally available to run the suite. The command installs dependencies as required. The make test-coverage command runs test suite and also creates an HTML coverage report in "build/coverage". The directory can later be cleaned with the make clean command.

The package is continuously tested by Travis CI.

Build Status Code Coverage

License

icanboogie/bind-prototype is licensed under the New BSD License - See the LICENSE file for details.