Download the PHP package viragrajput/router without Composer

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

Virag Router

ViragRouter is a lightweight PHP router package that allows you to easily define and handle routes in your PHP applications.

With ViragRouter, you're equipped with a robust suite of capabilities essential for efficient route handling: seamless route definition, dynamic parameter management, route grouping with middleware support, named routes for URL generation, and more. Its lightweight architecture guarantees minimal overhead, delivering optimal performance without sacrificing functionality.

Note :

ViragRouter is actively developed and continuously enhanced. While it's currently in its developmental phase and may contain occasional bugs, so it is not recommended for production use at this time. We appreciate your patience and understanding as i work towards delivering a stable and reliable product. However, you can safely use it for learning purposes, exploring its features, and exploring advanced routing concepts in PHP.

Installation

You can install ViragRouter via Composer:

Run local PHP Server

Usage

Creating Routes

You can define routes using the Route class provided by ViragRouter. Here's an example of how to define a route:

Route Parameters

You can define route parameters by enclosing them in curly braces {}. These parameters will be passed to your route handler. Here's an example:

Route Groups

You can group routes and apply common attributes using the group method. Here's an example:

Named Routes

You can name your routes using the name method. Named routes allow you to generate URLs based on the route name. Here's an example:

Middleware

You can apply middleware to routes using the middleware method. Middleware allows you to filter HTTP requests entering your application. Here's an example:

Generating URLs

You can generate URLs for named routes using the generateUrl method. Here's an example:

Handling Requests

You can handle incoming requests using the dispatch method of the Router class. Here's an example:

How To Use This Package in Your Custom PHP Project

Certainly! Below is an example of how you can integrate the ViragRouter package into your custom PHP Project:

Step 1: Install ViragRouter via Composer

First, install the ViragRouter package via Composer:

Step 2: Define Routes in Your Custom Project

In your custom Project, you'll need to define routes using the ViragRouter Route class. Here's an example of how you can define routes in your Project:

Step 3: Create a Router Instance and Handle Requests

In your Project entry point (e.g., index.php), create a router instance and handle incoming requests:

Step 4: Handle Requests in Your Custom Project

In your custom Project, ensure that you have logic to handle requests and invoke the appropriate route handlers based on the incoming requests.

Step 6: Additional Configuration (Optional)

Depending on your custom Project's architecture and requirements, you may need to configure additional features such as middleware, route groups, named routes, etc., provided by ViragRouter.

By following these steps, you should be able to integrate the ViragRouter package into your custom PHP project and define and handle routes effectively. Adjustments may be needed based on your project's specific requirements and architecture.

License

This package is open-source software licensed under the MIT license.



All versions of router with dependencies

PHP Build Version
Package Version
Requires viragrajput/http-foundation 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 viragrajput/router contains the following files

Loading the files please wait ....