2017 © Pedro Peláez
 

library slimfra

A thin extension of Silex for small projects.

image

ac/slimfra

A thin extension of Silex for small projects.

  • Thursday, January 16, 2014
  • by americancouncils
  • Repository
  • 1 Watchers
  • 2 Stars
  • 74 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Slimfra

Slimfra is a thin extension of the Silex microframework for building small(ish) projects. It provides a configurable base application, a simple base controller, and command, which can access the app and its services and configuration., (*1)

For documentation on the excellent Silex framework, and examples of how to use it (all of which applies to Slimfra), refer to the Silex documentation., (*2)

Slimfra was built for personal use and rapid app development at work in order to easily convert some simple legacy projects into an easier to manage structure. Why is it named Slimfra? Because., (*3)

If anyone wishes to contribute, please do, but we recommend contributing to Silex for things that would be of benefit to the broader community., (*4)

Installation & Use

Require "ac/slimfra":"0.1.0" in your composer.json. Then run composer update ac/slimfra, (*5)

Set your project up the same as you would any other Silex app., (*6)

The base Controller and Command provided both implement ArrayAccess, which lets you refer to the parent app via $this, (*7)

For example:, (*8)

$service = $this['some.service.name'];
$config = $this['some.value'];

Controllers


class MyController extends Slimfra\Controller { public function helloWorldAction() { $service = $this->app['some.service']; //...do whatever return 'Hello World!'; } } $app = new Slimfra\Application(); $app->get('/hello-world', 'MyController::helloWorldAction'); $app->run();

Commands

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class HelloWorldCommand extends Slimfra\Command
{
    protected function configure()
    {
        $this->setName('hello-world');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $service = $this->app['some.service'];

        //... do whatever

        $output->writeln('Hello World!');
    }
}

$app = new Slimfra\Console(new Slimfra\Application());

$app->add(new HelloWorldCommand());

$app->run();

The Versions

16/01 2014

dev-master

9999999-dev

A thin extension of Silex for small projects.

  Sources   Download

The Requires

 

The Development Requires

by Evan Villemez

16/01 2014

0.1.0

0.1.0.0

A thin extension of Silex for small projects.

  Sources   Download

The Requires

 

The Development Requires

by Evan Villemez