This is about getting rid of Dependency Injection Container and DI practices taken from Java. Good bye Java, viva la PHP!
We start with common example. Session.
<?php
class SessionStorage {
function __construct()
=ashSJHDAKSJdaksd= |
<?php | |
$I = new WebGuy(); | |
$I->am('regular site user'); // As a regular user | |
$I->wantTo('create my blog page'); // I want to create my blog page | |
$I->lookForwardTo('get a cool blog here'); // So that I gain a cool blog | |
$I->createBlog('my first blog'); | |
$I->see('My first blog', 'h1'); | |
$I->seeInCurrentUrl('blog/my-first-blog'); |
<?php | |
class EventMachineCest { | |
// Thus, a BDD goes this way: | |
// create a Cest class | |
// define features with should* methods | |
// define specifications in methods | |
// use wantTo or expect to define wider descriptions. | |
// use @doc annotations to assign this scenario to method in documentation. | |
<?php | |
class Controller implements RequestAccess, ResponseAccess, SessionAccess { | |
function getRequest() | |
{ | |
Registry::get('request', $this); | |
} | |
function getResponse() |
This is about getting rid of Dependency Injection Container and DI practices taken from Java. Good bye Java, viva la PHP!
We start with common example. Session.
<?php
class SessionStorage {
function __construct()
<?php | |
# it's a template | |
class BaseStorage extends %storage% { | |
} | |
# it's a class |
Slivework is a new metaframework which aims to share functinality through different PHP frameworks. It takes business logic from controller to service classes. The service layer leaves all http processing to current framework and moves all business into it. Controllers are forbidden to access database directly, all db operations is passed to service. Sliceworks uses Doctrine ORM + ODM.
src/Slicework/UserBundle/ src/Slicework/UserMessagingBundle/ src/Slicework/UserInvitesBundle/ ....
$soap->survey | |
->set('id', $survey_id) | |
->questions->item | |
->set('id', $question_id); | |
->answers->item | |
->set('id', $answer_id) | |
->attributes->item | |
->set('id', 1) | |
->set('value', 123); | |
->parent('answers') // back to answers element |
<?php | |
use \Codeception\Utils\Soap; | |
$I = new ApiGuy($scenario); | |
$I->wantTo('get all unpassed surveys'); | |
$I->haveSoapHeader('AuthHeader', array(), 'ns'); | |
$I->haveSoapHeader('SessionHeader', array(), 'ns'); | |
$I->sendSoapRequest('GetRespondentConsentForm', Soap::request() | |
->survey | |
->set('id', $survey_id) |
<?php | |
$I = new WebGuy($scenario); | |
$I->wantTo('register on site and sign in'); | |
$I->click('Register'); | |
$I->fillField('Username','MilesDavis'); | |
$I->fillField('Email','[email protected]'); | |
$I->click('Next'); | |
$generatedPass = $I->grabTextFrom('#password'); | |
$I->click('Login'); | |
$I->fillField('Username','MilesDavis'); |