Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 2 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 (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-07T14:34:33.000Z (10 months ago)
- Last Synced: 2024-11-16T00:20:31.305Z (2 months ago)
- Language: PHP
- Size: 40 KB
- Stars: 13
- Watchers: 3
- 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
[![redirect.pizza](https://redirect.pizza/favicons/open-graph.png)](https://redirect.pizza?ref=github)
[![Latest Version on Packagist](https://img.shields.io/packagist/v/enflow/redirect-pizza-php-sdk.svg?style=flat-square)](https://packagist.org/packages/enflow/redirect-pizza-php-sdk)
![GitHub Workflow Status](https://github.com/enflow/redirect-pizza-php-sdk/workflows/run-tests/badge.svg)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Total Downloads](https://img.shields.io/packagist/dt/enflow/redirect-pizza-php-sdk.svg?style=flat-square)](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 [email protected] 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.