sukohi/warp

这是一个主要针对Laravel开发的PHP包,用于通过会话记住重定向的URL。

2.0.3 2016-04-18 16:48 UTC

This package is not auto-updated.

Last update: 2024-09-10 02:53:44 UTC


README

这是一个主要针对Laravel开发的PHP包,用于通过会话记住重定向的URL。
(适用于Laravel 5+。 对于Laravel 4.2)

安装

在 composer.json 中添加此包名

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

执行 composer 命令。

composer update

在 app.php 中注册服务提供者

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

别名

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

用法

\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.

使用路由名称

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');

许可证

本软件包采用MIT许可证。

版权所有 2015 Sukohi Kuhoh