Download the PHP package agrandesr/agile-router without Composer

On this page you can find all versions of the php package agrandesr/agile-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 agile-router

Agile router

Agile router is a composer library designed to create APIs in PHP in a fast and efficient way. It is an agile and great router. The main ideas is to make the creation of apis:

  1. Agile: You can create first apis concept very quickly and improve with time.
  2. Easy: The idea is that the router make all the boring work of check parameters and the developer could start to work to fun parts of the project XD

How to start 🚀

Follow the next steps to start to working with this php router. If you found anything wrong or bad explained don't doubt to contact with us (correctly me... but us, sounds better 😅).

Prerequisites 📋

You will need to have installed php and composer in your computer.

Installation 🔧

You need to require the package to your project.

Next, you can use in your code. We encourage to use in the root file index.php. It is important to write under the autoload require.

Finally, you need to create a routes.json file to start to create your API.

There is a easy example to test!

With this you will have a operative endpoint "hi" with the content:

You only need to up the server with php. For example:

Now you can start to use the router json file following the documentation. We recommend to read quickly all the documentation at least one time before start. Yes, yes, it is boring, but trust me it will be very usefull.

Documentation

The main elements of the library are used in the Router file. But they can be use in different ways.

Future I will try to make an easy video tutorial to make easy the first steps.

Routes file options

The most important part of the framework are the routes files. The file, named routes.json have to be in the root of the project with index.php (you can change that with an advanced configuration, but first easy mode). In this file you can create and run a first operative API in a few steps.

The structure of the file is first, the paths; second, the methods; third, the framework properties for this endpoint.

The paths are defined by users and separated by the character "/". To indicate a dynamic route, that is to say that a slug of the route is variable, you should only enclose it in brackets ({}). For example:

The methods are the normal request methods:

Checkers

The framework consists of some properties to validate the most common data of a request, such as the parameters in the request or the Body.

Below is an example of a request using the available checkers.

How you can see you can check the body, header and request parameters in a easy way.

At the same time, you can use these values for the response indicated in content for renders of type JSON (it can also be used with renders of type SQL).

For specific checker documentation:

Render method

The render method or property within the JSON is in charge of performing the final action and whose objective is to print the final result of the API. The idea is that the JSON method can be used mainly to prototype your API and that the frontend can start working with the API already deployed in production. Afterwards, you can calmly work replacing the JSON-type renderer with a CLASS-type renderer to make the code you need. Also, from JSON and CLASS you have SQL type. This is intended for rapidly prototyping APIs that interface to a database. You can find more information on each method below.

PHP Framework tools

Hi! The next tools are optionals. There were created to develop the framework and they are already downloaded. For this reason, could be a good idea to make a look. If the classes are good for you, cool! If you don't like... You can only ignore them or rewrite the code to delete... 😭

Some relevant information

Routes priority

It is very important to know that the JSON path is from top to bottom. So if you write two possible routes, the first one will always be executed. It is very important to keep that in mind. For example, for the call:

With the Routes file (simplified):

Always will be enter to the configuration of the first route in your json file.









Aditional information

Versioning: 📌

For all available versions, see the tags in this repository.

Authors ✒️

You can also look at the list of all [contributors] (https://github.com/your/project/contributors) who have participated in this project.

License 📄

This project is under the License MIT - read the file LICENSE.md for more details.

Thanks to: 🎁


All versions of agile-router with dependencies

PHP Build Version
Package Version
Requires agrandesr/arrays Version ^1.1
agrandesr/array-conditions Version ^1.0
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 agrandesr/agile-router contains the following files

Loading the files please wait ....