2017 © Pedro Peláez
 

library components-routing

Use Laravel Routing Component Independently

image

endeavors/components-routing

Use Laravel Routing Component Independently

  • Saturday, June 16, 2018
  • by tbitowner
  • Repository
  • 0 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Components-Routing - Using new Laravel Routing features

Scrutinizer Code Quality, (*1)

This library enables the ability to use some of the new routing features only available in newer versions of the laravel framework such as signed urls (available starting in Laravel 5.6)., (*2)

Require this package in your composer.json and update composer., (*3)

composer require endeavors/components-routing

Installation

After updating composer, add the ServiceProvider to the providers array in config/app.php, (*4)

Endeavors\Components\Routing\FoundationServiceProvider::class,

Creating a signed route

You can create a signed route using the URL Facade., (*5)

URL::signedRoute('foo', ['id' => 1, 'username' => 'bob']);

For convenience, a helper can be used., (*6)

signed_route('foo', ['id' => 1]);

Validation

Validation of the signature is performed on the entire url., (*7)

use Illuminate\Support\Facades\Request;

public function verifyEmail()
{
    if (Request::hasValidSignature()) {
        // verify the email
    }
}

You may also check if the request is invalid., (*8)

use Illuminate\Support\Facades\Request;

public function verifyEmail()
{
    if (Request::hasInvalidSignature()) {
        // DON'T verify the email
    }
}

Validation can be performed only if specific parameters exist., (*9)

use Illuminate\Support\Facades\Request;

public function verifyEmail()
{
    // validate the signature if the email parameter exists
    if (Request::hasValidParameterSignature(['email'])) {
        // verify the email
    }
}

Again, you may check if the request has an invalid signature., (*10)

use Illuminate\Support\Facades\Request;

public function verifyEmail()
{
    // validate the signature if the email parameter exists
    if (Request::hasInvalidParameterSignature(['email'])) {
        // DON'T verify the email
    }
}

The Versions

16/06 2018

dev-master

9999999-dev

Use Laravel Routing Component Independently

  Sources   Download

MIT

The Requires