<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
carlosartur / slim-auto-routing-controller example snippets
use AutoRotingController\AutoRotingController;
use Slim\Psr7\Request;
use Slim\Psr7\Response;
class ExampleController extends AutoRotingController
{
/** Method to generate a "GET" /example route */
public function getAction(Request $request, Response $response)
{}
/** Method to generate a "POST" /example route */
public function postAction(Request $request, Response $response)
{}
/** Method to generate a "PUT" /example route */
public function putAction(Request $request, Response $response)
{}
/** Method to generate a "DELETE" /example route */
public function deleteAction(Request $request, Response $response)
{}
/** Method to generate a "OPTIONS" /example route */
public function optionsAction(Request $request, Response $response)
{}
/** Method to generate a "PATCH" /example route */
public function patchAction(Request $request, Response $response)
{}
/** Method to generate a "GET" /example/foo-bar route */
public function getFooBarAction(Request $request, Response $response)
{}
/** Method to generate a "POST" /example/foo-bar route */
public function postFooBarAction(Request $request, Response $response)
{}
/** Method to generate a "PUT" /example/foo-bar route */
public function putFooBarAction(Request $request, Response $response)
{}
/** Method to generate a "DELETE" /example/foo-bar route */
public function deleteFooBarAction(Request $request, Response $response)
{}
/** Method to generate a "OPTIONS" /example/foo-bar route */
public function optionsFooBarAction(Request $request, Response $response)
{}
/** Method to generate a "PATCH" /example/foo-bar route */
public function patchFooBarAction(Request $request, Response $response)
{}
}
/** Path prefix, to add a prefix on route */
protected const ROUTE_PREFIX = "";
/** To use a fixed path for all routes of a controller */
protected const ROUTE_FIXED = "";
/** The route methods has to have this value. All other methods of the class will be ignored */
protected const METHOD_ROUTE_SUFFIX = 'Action';
/** The prefix of the method used to call route function. You can implement your own callers. */
protected const CALL_FUNCTION_PREFIX = "callRouteMethod";
/** The argument regexes. The key is it's type. */
public const TYPES_REGEX = [
"int" => '[0-9]+',
"float" => '[+-]?([0-9]*[.])?[0-9]+',
];
/** The argument regexes. The key is it's name. */
public const PARAMETER_VALIDATION_REGEX = [
"id" => '[0-9]+',
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.