cobaia/spork-provider

Dependecy Injection provider for Spork to use in Silex or Cilex

dev-master 2012-08-26 14:23 UTC

This package is not auto-updated.

Last update: 2024-11-09 13:43:51 UTC


README

Dependency Injection provider for Spork can be used in Silex and Cilex.

How to use in Silex:

<?php

	$app->register(new Cobaia\Spork\Provider\Silex\SporkProvider());
	$app['spork']->fork(function() {
    	// do something in another process!
    	return 'Hello from '.getmypid();
	})->then(function(Spork\Fork $fork) {
    	// do something in the parent process when it's done!
    	echo "{$fork->getPid()} says '{$fork->getResult()}'\n";
	});

How to use in Cilex:

<?php

	$app->register(new Cobaia\Spork\Provider\Cilex\SporkProvider());
	$app['spork']->fork(function() {
    	// do something in another process!
    	return 'Hello from '.getmypid();
	})->then(function(Spork\Fork $fork) {
    	// do something in the parent process when it's done!
    	echo "{$fork->getPid()} says '{$fork->getResult()}'\n";
	});