Download the PHP package skalar/router without Composer

On this page you can find all versions of the php package skalar/router. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package router

router

Router component for bitrix

use

copy vendor/skalar/router/examples/router folder into your namespace (example /local/components/skalar)

configure .htaccess redirects to index.php

call component in index.php: $APPLICATION->IncludeComponent( "skalar:router", "", [ 'BASE_URL' => '/path' ], false ); example vendor/skalar/router/examples/root/index.php params: BASE_URL - routing folder (optional) you also add rule to urlrewrite.php array ( 'CONDITION' => '#^/path/#', 'ID' => NULL, 'PATH' => '/path/index.php', 'SORT' => 90, ),

Routing basic on the components symfony "symfony/http-foundation" and "symfony/routing", for more information read documentation for these packages.

Work with templates .default (or another template).

public

Routes configure config/routes.yaml. Controllers must extends Skalar\Controller\PublicController and have namespace Skalar\Controller. They should be located in the folder "controllers". All controller actions receive 2 params: Symfony\Component\HttpFoundation\Request $request and array $state. You can get any request arguments: $request->get("param"); All controllers return array $state. You can set headers in controller use protected property "headers" - Symfony\Component\HttpFoundation\ResponseHeaderBag. You can set response status use controller method setStatus() By default router response is json. You can override controller the getRender() method. It returns a closure that renders content. Closure get 2 arguments: array $state and string $url, return string content;

middleware

Middleware calling before any public controller action. Example in folder middleware. Middleware class must have only one method __invoke(). This method work like controller action.

api

api has its own routing. You must extends Skalar\Routing\AbstractApi and implement method getRoutes(). Your class must be located in api folder. skalar/router have two implemented APIs: rest and graphQl (Skalar/Api/Rest and Skalar/Api/GraphQl). You can take them as a basis for implementing your APIs.

rest

Work folder rest. All rest controller have two methods get and post. They take 0, 1 or 2 arguments. Use $request->get('param1') and $request->get('param2'). Route for rest is like /rest/test/{param1}/ where test is name of controller in lowercase. You can override rest api in the folder api in your class extends Skalar/Api/Rest or directly Skalar\Routing\AbstractApi.

graphQl

Work folder graphql. Route /graphql/. In folder graphql located two basic type. Another types must be realized as these. Type - is class which extends GraphQL\Type\Definition\ObjectType or another. It must have namespace Skalar\Type. It include in other type as Skalar\GraphQL\Types::catalog() where catalog is name of class type in lowercase. For more information, read the documentation for the package "webonyx/graphql-php" http://webonyx.github.io/graphql-php/.


All versions of router with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
symfony/http-foundation Version ^3.4
symfony/routing Version ^3.4
symfony/validator Version ^3.4
symfony/config Version ^3.4
symfony/dependency-injection Version ^3.4
symfony/yaml Version ^3.4
symfony/http-kernel Version ^3.4
overblog/graphql-bundle Version 0.11.x-dev
webonyx/graphql-php Version 0.12.x-dev
twig/twig Version ^2.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package skalar/router contains the following files

Loading the files please wait ....