Download the PHP package roy404/routes without Composer

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

ROUTES - HTTP Handler

Install the bundle using Composer:

Route Feature Documentation

The route feature allows you to manage HTTP requests easily in your application. To set up and use this feature, follow the instructions below:

Available Methods

Http Methods

Route Configuration

Example Route Configuration Methods

  1. Group static group(array $attributes, \Closure $action).

    • Description Registers a group of routes that share common configurations or middleware. This method enhances route organization and reusability by allowing you to apply settings or middleware to multiple routes at once.
    • Usage:

    • Parameters
      • $attributes: An array of configuration options for the group (e.g., middleware, prefix, etc.).
      • $action: A closure that contains all routes to be grouped.
  2. Controller static controller(string $className)

    • Description Registers a controller class that will handle requests for specific routes.
    • Usage

    • Parameters
      • $className: The class name of the controller to handle the route.
  3. Middleware: static middleware(string|array $action)

    • Description Registers middleware for a specific route. Middleware can perform various tasks, such as authentication, logging, and security checks.
    • Usage

    • Parameters:
      • $action: The middleware action or array of middleware to apply to the route.
  4. Prefix static prefix(string $prefix)

    • Description Adds a prefix to the URI of the route, which is useful for route grouping (e.g., adding /admin for admin routes).
    • Usage

    • Parameters
      • $prefix: Append the prefix before the URI.
  5. Name static name(string $name)

    • Description Assigns a name to a route. This makes it easier to refer to the route later in your code, especially when generating URLs.
    • Usage

    • Parameters
      • $name: The name to assign to the route.
  6. Domain static domain(string $domain)

    • Description Restricts a route to a specific domain, useful for multi-domain applications (e.g., admin.example.com or api.example.com).
    • Usage

    • Parameters
      • $domain: The domain to associate with the route.

Getting Started

  1. Configuring Routes: To configure and use the routing system, you need to call the Route::configure() function at the start of your application (usually in your main entry point file, like index.php or app.php).

  2. Using the Routes Feature After configuring your routes as described in Step 1, you can now start using the route feature to register your routes and define actions that should be taken when those routes are accessed.

In the example below, we use the Route::get() method to register a route for the homepage (/), which will echo Hello World! when visited.

How to run a single file in application?

To set up routing in your application, ensure that your web server is configured to use URL rewriting. This allows your application to route requests properly. Below are the configurations for both Apache or Nginx servers.

Apache

If you are using an Apache web server, add the following code to your .htaccess file located in your application's root directory:

Nginx

For Nginx, you will need to configure the server block in your Nginx configuration file (usually located in /etc/nginx/sites-available/default or a similar path). Add the following rules to handle URL rewriting:


All versions of routes with dependencies

PHP Build Version
Package Version
Requires php Version ^8.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 roy404/routes contains the following files

Loading the files please wait ....