Giter Club home page Giter Club logo

minibus's Introduction

Minibus Build Status Scrutinizer Code Quality

Hey welcome to you traveler! You are looking for a way of traveling through your software easily? Do not search anymore, you've just find the place!

Ladies and gentleman, let me present you the famous, the incredible, the revolutionary PHP Minibus !

The goal

If you are like me, you are probably coding software solutions. In many software architectures the story starts with an Entry point (cf: a controller in an MVC application). But if you think about this Entry Point you probably agree with me that it's not only one point but, in many cases, a mix of many components!

In order to avoid what I call SMFB architecture (understand: Super Mega Fuc**** Brain, as the Controller) I present you Minibus!

The principle is simple. In order to handle an application Entry Point we need three components:

  • A Minibus, which contains various passengers (understand data).
  • Some Stations, that can handle a minibus at some point (replace the controller).
  • Finally a bus Line that contains Stations and can guide a Minibus

MVC vs MVB (Model View Bus)

To understand the differences between those two patterns here is some wonderful art illustrating the point:

The MVC

MVC Art

The MVB

MVB Art

I can't wait! Let's start traveling!

If you're wondering how it is possible to travel through software lands with php, this is the answer:

<?php

use Symfony\Component\EventDispatcher\EventDispatcher;
use Knp\Minibus\Simple\Line;
use Knp\Minibus\Simple\Minibus;

# Before traveling, we need a bus line
$busLine = new Line(new EventDispatcher);

# Okay, in order to take all the minibus passengers to their destination we need to create
# Bus stations !
class DreamlandStation implements Station
{
    public function handle(Minibus $minibus)
    {
        // let's interact with the minibus
        $minibus->addPassenger('sheldon', ['name' => 'sheldon']);
    }
}

# Let's add the station to our bus line :
$busLine->addStation(new DreamlandStation);

# Now we just to make the bus line leads the minibus:
$busLine->lead(new Minibus);

Get more!

TODO

minibus's People

Contributors

djeg avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.