sukohi/warp

A PHP package mainly developed for Laravel to remember URLs to redirect through session.

2.0.3 2016-04-18 16:48 UTC

This package is not auto-updated.

Last update: 2024-11-19 03:37:30 UTC


README

A PHP package mainly developed for Laravel to remember URLs to redirect through session.
(This is for Laravel 5+. For Laravel 4.2)

Installation

Add this package name in composer.json

"require": {
  "sukohi/Warp": "2.*"
}

Execute composer command.

composer update

Register the service provider in app.php

'providers' => [
    ...Others...,  
    Sukohi\Warp\WarpServiceProvider::class,
]

Also alias

'aliases' => [
    ...Others...,  
    'Warp'   => Sukohi\Warp\Facades\Warp::class
]

Usage

\Warp::set('my_place');
\Warp::set('my_place', $current_url = '');  // or You can set URL you want to keep.


// After moving some pages 

$url = \Warp::get('my_place');
$url = \Warp::get('my_place', $alternative_url = 'http://example.com');    // You also can set alternative(default) URL.
$url = \Warp::get('my_place', $alternative_url, $forget_flag = true);      // If $forget_flag is false, URL you set will not be removed.

with Route name

Warp::set('your.route.name');   // the argument is optional. If in the case, route name automatically will be set.

// After moving some pages 

$url = Warp::route('your.route.name');

License

This package is licensed under the MIT License.

Copyright 2015 Sukohi Kuhoh