Skip to content
This repository has been archived by the owner on May 3, 2020. It is now read-only.

Slim Controllers is an extremely lightweight controller framework for Slim 3

License

Notifications You must be signed in to change notification settings

icosillion/slim-controllers

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slim Controllers

Slim Controllers is an extremely lightweight framework to provide controllers for Slim 4.

Installation

composer require icosillion/slim-controllers

Usage

Use Slim's groups to group your controller actions together in your main Slim file.

<?php

use Slim\App;

$app = new App();

$app->group('/', function () use ($app) {
    $controller = new RootController($app);

    $app->get('', $controller('index'));
});

$app->run();

Extend your controller from the Controller class.

<?php

use Icosillion\SlimControllers\Controller;
use Slim\Http\Request;
use Slim\Http\Response;

class RootController extends Controller
{
    public function index(Request $request, Response $response, array $args)
    {
        $response->getBody()->write('Hello World!');

        return $response;
    }
}

License

This project is licensed under the MIT license. A copy of this is available in the LICENSE file.

About

Slim Controllers is an extremely lightweight controller framework for Slim 3

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%