enflow / redirect-pizza-php-sdk
An SDK to easily work with the redirect.pizza API
Fund package maintenance!
redirect.pizza/pricing
Requires
- php: ^8.2
- guzzlehttp/guzzle: ^7.5
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.3
- mockery/mockery: ^1.5.1
- phpunit/phpunit: ^10.5|^11.0
README
Installation
composer require enflow/redirect-pizza-php-sdk
Usage
$apiToken = 'rpa_XXXXXXXXXXXXXXXXXXX'; // You can find this token on https://redirect.pizza/api $redirectPizza = new \RedirectPizza\PhpSdk\RedirectPizza($apiToken); // List all redirects $redirectPizza->redirects(); // Create redirect $redirect = $redirectPizza->createRedirect([ 'sources' => ['old-source.nl'], 'destination' => 'new-fancy-site.nl', 'redirect_type' => 'permanent', 'keep_query_string' => false, ]); // Fetch redirect $redirectPizza->redirect($redirect->id); // Update redirect $redirect->update([ 'sources' => ['old-source.nl'], 'destination' => 'new-fancy-site-v2.nl', 'redirect_type' => 'permanent', 'keep_query_string' => true, ]); // Delete the redirect $redirect->delete();
Security
If you discover any security related issues, please email support@redirect.pizza instead of using the issue tracker.
Credits
This package uses code from and is greatly inspired by the OhDear PHP SDK by Freek van der Herten and Mattias Geniar, which is based on Forge SDK package by Mohammed Said.
License
The MIT License (MIT). Please see License File for more information.