2017 © Pedro Peláez
 

library slim-found-handler

Slim 3 found handler

image

z7zmey/slim-found-handler

Slim 3 found handler

  • Saturday, April 2, 2016
  • by z7zmey
  • Repository
  • 1 Watchers
  • 0 Stars
  • 216 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 2 % Grown

The README.md

SlimFoundHandler

Instalation

$ composer require z7zmey/slim-found-handler

Application Configuration

$app = new \Slim\App([
    'foundHandler' => function () {
        return new \z7zmey\SlimFoundHandler();
    }
]);

Examples

You may use only required parameters, (*1)

$app->get('/', function (\Slim\Http\Response $response) {
    $response->getBody()->write("Hello");
    return $response;
});

You can get access the route argument by using the same variable name, (*2)

$app->get('/example1/{name}', function ($name) {
    echo "Hello, {$name}";
});

You can get access to all route arguments as array, (*3)

$app->get('/example2/{first}/{second}', function (array $routeArguments) {
    echo "{$routeArguments['first']} {$routeArguments['second']}";
});

The sequence of parameters doesn't matter, (*4)

use \Slim\Http\Response;
use \Slim\Http\Request;

$routeHandler = function ($first, Response $res, array $params, Request $req) {
    $second = $params['second'];
    $third = $req->getAttribute('route')->getArgument('third');

    $res->getBody()->write("{$first} {$second} {$third}");
    return $res;
};

$app->get('/example3/{first}/{second}/{third}', $routeHandler);

The Versions

02/04 2016

dev-master

9999999-dev https://github.com/z7zmey/SlimFoundHandler

Slim 3 found handler

  Sources   Download

BSD

The Requires

 

The Development Requires

by Vadim Slizov

slim slimframework slim3 foundhandler

02/04 2016

0.1

0.1.0.0 https://github.com/z7zmey/SlimFoundHandler

Slim 3 found handler

  Sources   Download

BSD

The Requires

 

The Development Requires

by Vadim Slizov

slim slimframework slim3 foundhandler