2017 © Pedro Peláez
 

library slim-magic

An auto router, auto discovery class mapper/loader for Slim Framework 3. Keeping your Slim bootstrapping clean no matter how many routes, dependencies and middleware you have.

image

atlantic8-web/slim-magic

An auto router, auto discovery class mapper/loader for Slim Framework 3. Keeping your Slim bootstrapping clean no matter how many routes, dependencies and middleware you have.

  • Sunday, September 24, 2017
  • by atlantic8-web
  • Repository
  • 1 Watchers
  • 3 Stars
  • 47 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

slim-magic

A bootstrapper/classmapper/loader for Slim Framework 3x. Keeping your Slim bootstrapping clean no matter how many routes, dependencies and middleware you have, allowing you to build really large applications in a structured manner., (*1)

Installation

It's recommended that you use Composer to install SlimMagic., (*2)

$ composer require atlantic8-web/slim-magic "^1.0"
// or add to your existing composer.json file

This will install SlimMagic and all required dependencies. SlimMagic requires PHP 5.5.0 or newer., (*3)

Configuration

'slim_magic_settings' => [
        'debug'=>false,
        'routes' => [
            //Home
            '/' => [
                'methods' => ['GET'], //Can be an array of methods, or ommit for default GET
                'classmap' => 'app\Home:index', //String resolver app
                'middleware' => [], //Middleware to load for this app
                'arguments' => [],//Arguments to pass to this app
                'name' => 'home' //App name, also used to generate URL's $slim->setName(...)
            ],
            '/admin/dashboard' => [
                'methods' => ['GET'],
                'classmap' => 'app\Admin:dashboard',
                'middleware' => ['AuthValidation', 'GrapPreload'],
                'arguments' => ['isAdmin'],
                'name' => 'admin_dashboard'
            ]
        ],
        //This will be applied to all routes/apps
        'all' => [
            'middleware' => ['Test', 'Session'],//See Slim docs for importance of order               
            'service' => ['SessionHelper', 'Twig', 'notFoundHandler'] //Service dependencies
        ]
    ]

Directory structure

In order to keep things clean we can use folders and service bootstrapper classes - See code example, (*4)

MyNewApp
    -app
    -config
        -slim.php
    -service
        -Dependency
        -Middleware
    -view
    -model
-.htaccess
-index.php

Usage

Create a Slim config.php and add SlimMagic route setup and configuration - See code example, (*5)

Create an index.php file with the following contents:, (*6)

<?php

require 'vendor/autoload.php';

$container = new \Slim\Container(require 'config/slim.php');

$service = new \SlimMagic\ServiceContainer(new \Slim\App($container), $container->slim_magic_settings);
new \SlimMagic\Mapper($service);

$service->getSlim()->run();

See code example, configuration and architecture Example, (*7)

License

The SlimMagic is licensed under the MIT license. See License File for more information., (*8)

The Versions

24/09 2017

2.0.x-dev

2.0.9999999.9999999-dev https://github.com/atlantic8-web/slim-magic

An auto router, auto discovery class mapper/loader for Slim Framework 3. Keeping your Slim bootstrapping clean no matter how many routes, dependencies and middleware you have.

  Sources   Download

MIT

The Requires

  • php ~7.1

 

by christof

framework bootstrap mvc slim slimphp slim 3 class mapper auto router

24/09 2017

2.0

2.0.0.0 https://github.com/atlantic8-web/slim-magic

An auto router, auto discovery class mapper/loader for Slim Framework 3. Keeping your Slim bootstrapping clean no matter how many routes, dependencies and middleware you have.

  Sources   Download

MIT

The Requires

  • php ~7.1

 

by christof

framework bootstrap mvc slim slimphp slim 3 class mapper auto router

30/12 2016

1.0.2.x-dev

1.0.2.9999999-dev https://github.com/atlantic8-web/slim-magic

An auto router, auto discovery class mapper/loader for Slim Framework 3. Keeping your Slim bootstrapping clean no matter how many routes, dependencies and middleware you have.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by christof

framework bootstrap mvc slim slimphp slim 3 class mapper auto router

30/12 2016

v1.0.2

1.0.2.0 https://github.com/atlantic8-web/slim-magic

An auto router, auto discovery class mapper/loader for Slim Framework 3. Keeping your Slim bootstrapping clean no matter how many routes, dependencies and middleware you have.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by christof

framework bootstrap mvc slim slimphp slim 3 class mapper auto router

12/12 2016

1.0.1.x-dev

1.0.1.9999999-dev https://github.com/atlantic8-web/slim-magic

An auto router, auto discovery class mapper/loader for Slim Framework 3. Keeping your Slim bootstrapping clean no matter how many routes, dependencies and middleware you have.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by christof

framework bootstrap mvc slim slimphp slim 3 class mapper auto router

23/08 2016

1.0.1-stable

1.0.1.0 https://github.com/atlantic8-web/slim-magic

An auto router, auto discovery class mapper/loader for Slim Framework 3. Keeping your Slim bootstrapping clean no matter how many routes, dependencies and middleware you have.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by christof

framework bootstrap mvc slim slimphp slim 3 class mapper auto router

23/08 2016

dev-master

9999999-dev https://github.com/atlantic8-web/slim-magic

An auto router, auto discovery class mapper/loader for Slim Framework 3. Keeping your Slim bootstrapping clean no matter how many routes, dependencies and middleware you have.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by christof

framework bootstrap mvc slim slimphp slim 3 class mapper auto router

14/08 2016

1.0.0

1.0.0.0 https://github.com/atlantic8-web/slim-magic

An auto router, auto discovery class mapper/loader for Slim Framework 3. Keeping your Slim bootstrapping clean no matter how many routes, dependencies and middleware you have.

  Sources   Download

MIT

The Requires

 

by christof

framework bootstrap mvc slim slimphp slim 3 class mapper auto router

03/08 2016

v0.1

0.1.0.0 https://github.com/atlantic8-web/slim-magic

An auto router, auto discovery class mapper/loader for Slim Framework 3. Keeping your Slim bootstrap truly "slim" no matter how many routes and apps/controllers you have.

  Sources   Download

MIT

The Requires

 

by christof

framework bootstrap mvc slim slimphp slim 3 class mapper auto router