Download the PHP package splashsky/simplerouter without Composer

On this page you can find all versions of the php package splashsky/simplerouter. 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 simplerouter

SimpleRouter

Aloha! SimpleRouter is a super-small, lightweight, and easy-to-use router for your PHP project. It can handle any type of request, and features RegEx pattern matching for URI parameters. You can also easily define routes for 404 and 405 errors.

As this implementation is very simple, it works great as boilerplate for a more complicated router if your project demands it. I created this to serve as a basic router for a small RPG game in PHP. Let me know what you use it for in the Discussions tab!

Usage

Installation

The easiest way to use SimpleRouter is to install it in your project via Composer.

Otherwise, download the latest Release and use include or require in your code.

Caveats

Using SimpleRouter is... simple! There's a couple of principles to note, however.

Root Route

You can't have an empty route (Router::get('', ...);), as the router always assumes you at least have a / in your URI. The root route should always be /, such as in Router::get('/', function () {});.

Parameters are in order they appear

In the example of /api/hello/{name}, your first instinct when getting this parmeter in your action is that the variable will be named $name. This isn't the case - route parameters are in the order they are found in the route, and names are irrelevant.

Routing for subfolders

If you're wanting to route for seperate uses (such as an api), you can create another entrypoint (in /api/v1 for example) and pass a custom base path to the router.

Ensure that your web server points traffic from /api/v1 to this entrypoint appropriately.

Contributing

I'm happy to look over and review any Issues or Pull Requests for this project. If you've run into a problem or have an enhancement or fix, submit it! It's my goal to answer and review everything within 48 hours.

Credit

Most of the code so far has been initially written by @SteamPixel, so make sure to give him a follow or a star on the original repo as well. Thanks!

License

This project is licensed under the MIT License. See LICENSE for further information.


All versions of simplerouter with dependencies

PHP Build Version
Package Version
No informations.
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 splashsky/simplerouter contains the following files

Loading the files please wait ....