Skip to content

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.

Notifications You must be signed in to change notification settings

natanael-aguiar/safe-redirect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Safe Redirect

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!

About

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.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages