natanael-aguiar/safe-redirect
最新稳定版本:v1.0.0
Composer 安装命令:
composer require natanael-aguiar/safe-redirect
包简介
A simple way to redirect your pages with PHP easily and safely
README 文档
README
Safe Redirect is a PHP package that provides a simple and safe way to perform HTTP redirects in your applications. It allows you to make redirects with customizable HTTP status codes, offering flexibility and security when handling user navigation.
Instalação
You can install Safe Redirect via Composer. Run the following command in the terminal:
composer require natanael-aguiar/safe-redirect
Use
To use Safe Redirect in your application, first, import the SafeRedirect class and then create an instance of it. You can pass a custom HTTP status code when creating the instance, or use the default status code, which is 302 (Found).
<?php
require_once 'vendor/autoload.php';
use SafeRedirect\SafeRedirect;
// Creating a SafeRedirect instance with custom status code (optional)
$redirect = new SafeRedirect(301);
// Redirecting to a specific URL
$redirect->to('https://example.com');
In the example above, a redirect to https://example.com is done with HTTP status code 301 (Moved Permanently).
Have fun!
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2023-10-13