https://github.com/enflow/redirect-pizza-php-sdk
An SDK written in PHP to work with redirect.pizza
https://github.com/enflow/redirect-pizza-php-sdk
Last synced: 11 months ago
JSON representation
An SDK written in PHP to work with redirect.pizza
- Host: GitHub
- URL: https://github.com/enflow/redirect-pizza-php-sdk
- Owner: enflow
- License: mit
- Created: 2018-08-07T09:22:17.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2025-02-22T20:05:13.000Z (over 1 year ago)
- Last Synced: 2025-06-22T11:47:50.219Z (about 1 year ago)
- Language: PHP
- Size: 41 KB
- Stars: 14
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# SDK to easily work with the redirect.pizza API
[](https://redirect.pizza?ref=github)
[](https://packagist.org/packages/enflow/redirect-pizza-php-sdk)

[](LICENSE.md)
[](https://packagist.org/packages/enflow/redirect-pizza-php-sdk)
## Installation
```composer require enflow/redirect-pizza-php-sdk```
## Usage
```php
$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
- [Michel Bardelmeijer](https://github.com/mbardelmeijer)
- [All Contributors](../../contributors)
This package uses code from and is greatly inspired by the [OhDear PHP SDK](https://github.com/ohdearapp/ohdear-php-sdk) by [Freek van der Herten](https://github.com/freekmurze) and [Mattias Geniar](https://github.com/mattiasgeniar), which is based on [Forge SDK package](https://github.com/themsaid/forge-sdk) by [Mohammed Said](https://github.com/themsaid).
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.