porkchopsandwiches/preserialiserserviceprovider

A Silex Service Provider for the Preserialiser

1.0.0 2015-03-09 03:13 UTC

This package is not auto-updated.

Last update: 2024-05-11 14:23:52 UTC


README

A Silex Service Provider for the Preserialiser library.

use PorkChopSandwiches\PreserialiserServiceProvider\PreserialiserServiceProvider;

$app -> register(new PreserialiserServiceProvider(), array(
	"preserialiser.default_args"    => array()
));

$result = $app["preserialiser"] -> preserialise(...);

Also includes a trait for simple shortcut methods and code completion

class MyApplication extends \Silex\Application {
	use PorkChopSandwiches\PreserialiserServiceProvider\PreserialiserTrait;
}

$app = new MyApplication();

$app -> get("/", function () {

	# Access Preserialiser instance
	$app -> getPreserialiser() -> addDefaultArgs(array("foo" => true)) -> preserialise(...);

	# Invoke preserialise() directly
	$result = $app -> preserialise(...);
});

Install via Composer

{
	"require": {
		"porkchopsandwiches/preserialiserserviceprovider"
	}
}