Download the PHP package amranich/ajax-router without Composer

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

packagist tests License

Getting Started

You can copy/paste this code snippet for a quick start.

We're using Guzzle PSR-7 interface implementation here, but you can use any other library you like as long as it implements the same interface.

Usage Tips

Route to controller/class method

If you like to put the business logic in a separate class or in a controller, you can route your requests to them like this :

Or :

If the controller/class has some dependencies that must be passed within the constructor, you can still instantiate the controller on yourself :

Catch route actions exceptions

I want to catch exceptions that only occurs from my routes actions, and not those thrown by the library or somewhere else, how I can do that ?

Answer :

Get current route

You can access the current route object using the static method getCurrentRoute of the Route class.

Background

The idea of the library came to my mind a long time ago when I was mostly developing web applications using just plain PHP, some of these applications were performing a lot of AJAX requests into a single PHP file, that file can have a hundred lines of code that process these requests depending on a function/method name that sent along with the request, so I started to think of what I can do to improve the way that these requests are handled, and improve the code readability and maintainability.

Prizes

This package wins the PHP Innovation Award (February 2022) Issued by phpclasses.org

🏆 Prize : One elePHPant mascot. https://www.php.net/elephpant.php

📜 Certificate : https://amranich.dev/certs/phpclasses-february-2022-innovation-award.pdf

They support this project


All versions of ajax-router with dependencies

PHP Build Version
Package Version
Requires php Version ^5.6 || ^7.0 || ^8.0
psr/http-message Version ^1.0
lazzard/psr7-response-sender 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 amranich/ajax-router contains the following files

Loading the files please wait ....