Download the PHP
package zkrati/router without Composer
On this page you can find all versions of the php package
zkrati/router. It is possible to download/install
these versions without Composer. Possible dependencies are resolved
automatically.
Vendor zkrati Package router Short Description PHP router as simple as can be License
MIT
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.
supports GET, POST, PUT, DELETE and PATCH requests
Version
1.0
Basic usage
simple right?
You can also use other handler declarations
If you need to create your own instance for some reason, you can pass the created instance
Variables
You will propably need to map routes with some varibles in it. It was never been easier.
Parameters
If you need to add the parameters to url, you can. It will be passed to your handler as second parameter.
Url wildcards
If you are in situation when you are interested only in first half of the path you can use a wildcard.
You can even use it as a wildcard for all requests, for example:
You can also combine it with variables:
Headers
Sometimes is useful to know the request headers. You don't need to search it somewhere anymore. Just add third parameter to your handler function.
Exceptions
It is a good idea to wrap route declarations into try catch because in case of invalid handler it will throw InvalidHandlerException
also $router->run(); throws RouteNotFoundException when it founds no route for current url
Instances
If you have custom class in your app which manages instances of all other classes and you want tou use string handler definition you can pass your instantiator into router. The router will get class instances from your custom instantiator.
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 zkrati/router contains the following files
Loading the files please wait ....
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.