PHP code example of amir-hossein5 / laravel-routin

1. Go to this page and download the library: Download amir-hossein5/laravel-routin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

amir-hossein5 / laravel-routin example snippets


Routin::routes()
  ->withoutParameter()
  ->method('get')
  ->getUri();

array:3 [▼
  0 => "/"
  1 => "user"
  2 => "user/create"
]

use AmirHossein5\Routin\Facades\Routin;


Routin::routes()
  ->withoutParameter()
  ->get(fn ($route) => [
    $route->uri => $route
  ])
  
// output

array:2 [▼
  "user/create" => Illuminate\Routing\Route {#1109 ▶}
  "book/{book}" => Illuminate\Routing\Route {#1108 ▶}
  ...
]

use AmirHossein5\Routin\Facades\Routin;


Routin::routes()
  ->withoutParameter()
  ->method('post')
  ->get()
  
// output

array:2 [▼
  "user.store" => Illuminate\Routing\Route {#1109 ▶}
  "book.store" => Illuminate\Routing\Route {#1108 ▶}
]

Routin::routes()
  ->withoutParameter()
  ->method('get')
  ->getUri()

// output

array:3 [▼
  0 => "/"
  1 => "user"
  2 => "user/create"
]

Routin::routes()
  ->method('put')
  ->getParameters()

// output

array:2 [▼
  "user.update" => array:1 [▼
    0 => "user"
  ]
  "book.update" => array:1 [▼
    0 => "book"
  ]
]

Routin::routes()
  ->getName()

// output

array:7 [▼
  0 => "user.index"
  1 => "user.create"
  2 => "user.store"
  3 => "user.show"
  4 => "user.edit"
  5 => "user.update"
  6 => "user.destroy"
]