Download the PHP package dentro/yalr without Composer

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

YALR (Yet Another Laravel Router)

Test Coding Standard codecov Total Downloads Laravel Octane Compatible

Define Laravel routes in different ways using Route Attribute

Previously known as jalameta/router.

TABLE OF CONTENT

Installation

Using composer :

Requirements

Laravel Yalr
8.x ^1.0
9.x ^1.1
10.x ^1.2
11.x ^1.3

Applying into your project

Run command in your project

If you're deciding to remove the original laravel routes, you might add --remove option within the command. So the command will be

YALR will configure the routes for you, the Laravel default routes folder will be deleted. So backup your defined routes first.

Usage

Class Wrapper Route

Class wrapper route is our effort to make routing in laravel more expressive and separated. We usually make route that representative with namespace for easy to understand. For example, class App\Admin\TransactionRoute will represent route /app/admin/transaction.

Creating new route

To make a new route just run:

After running command above, the route named DefaultRoute will appear in app/Http/Routes/DefaultRoute.php. After creating routes, it will not be loaded automatically, you must register the Route Class in the route configuration.

make:route options
  1. Inject Inject is useful options to auto adding the route class name within route configuration, so you don't need to add it manually. E.g:

Command above will make the Default route within the web groups that defined in config/routes.php.

  1. Controller The controller option will generate the route and the controller used by the route. So you don't need to run 2 artisan command to create a new controller and route.

  2. Help Shows YALR command helps

Routes Configuration

Below is an example of YALR configurations.

As you can see, groups index is group configuration, you can pass any laravel options there such as as, domain, middleware, prefix, etc. Afterward, the web and api are group index defined before in the groups index. It is an array of route class names.

Class Structure

After creating a route with the command, we will see the example of the generated file.

After creating a route with the command, we will see the example of the generated file. We can define routes within the register method. All you need is to call $this->router as a router instance. Then, we can invoke the laravel routing method such as post, put, etc. See Laravel Routing Docs.

Avoid using closure action, otherwise your application will encounter error when routes were cached.

Using Controller

From create route command, we know we can pass the controller namespace. The created controller will show up in the route class as a controller method.

The route above is equal with

This package want to solve those duplicated namespace and class name several times as we define the routes. Or if you don't want to use the controller in the route class, you can pass the second parameter of $this->uses() method with the controller class name to be used, E.g : $this->uses('login', LoginController::class).

Route Prefix

Override the route prefix defined in the class property. Default prefix is '/';

protected string $prefix = '/home';

The route above is equal with

Route Name

You need to define the route name property within the route class

protected string $name = 'home';

Later we can use $this->name() method for adding separation with dot (.) between the route group name, and the single route name

It equal with

Preloads

Preloads always run even though routes been cached. It might be the good place to put route model binding and rate limiter there.
Example :

Route Attribute

PHP 8 comes up with a nice feature called Attribute see this link for the detail. So we added those feature to this package for us to create something like the example below.

Available Class Target

Available Method Target

Added To Configuration Route

just put class to your route configuration and yalr will figure it out what to do with your controller.


All versions of yalr with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.0
illuminate/console Version ^8.0|^9.0|^10.0|^11.0
illuminate/routing Version ^8.0|^9.0|^10.0|^11.0
illuminate/filesystem Version ^8.0|^9.0|^10.0|^11.0
illuminate/contracts Version ^8.0|^9.0|^10.0|^11.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 dentro/yalr contains the following files

Loading the files please wait ....