https://github.com/bigwing/pet-and-go-wp
PHP library for interacting with the PetAndGo.com API within the context of WordPress.
https://github.com/bigwing/pet-and-go-wp
api-client php-library wordpress
Last synced: about 1 month ago
JSON representation
PHP library for interacting with the PetAndGo.com API within the context of WordPress.
- Host: GitHub
- URL: https://github.com/bigwing/pet-and-go-wp
- Owner: bigwing
- License: mit
- Created: 2020-08-24T22:16:30.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-15T17:29:56.000Z (almost 6 years ago)
- Last Synced: 2025-06-10T22:38:49.750Z (about 1 year ago)
- Topics: api-client, php-library, wordpress
- Language: PHP
- Size: 178 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# PetAndGo WP
PHP library for interacting with the PetAndGo.com API within a WordPress site.
[](https://github.com/php-pds/skeleton)
[](https://github.com/bigwing/pet-and-go-wp/blob/master/LICENSE)
## Installation
Install using Composer `composer require bigwing/pet-and-go-wp` and use the Composer autoloader.
## Configuration
The only required setting is your PetAndGo API key (`authkey`), which must be passed to the class on instantiation.
Common ways to do this:
- In `wp-config.php`, set a constant with `define( 'PET_AND_GO_AUTHKEY', 'your_auth_key' );`.
- Use dotEnv to set the key.
- Create a WP settings page and store the key there.
## Usage
You can use this inside a theme or plugin, but this package DOES NOT dictate front-end output.
- Use the Composer autoloader to ensure the files are loaded.
- Instantiate the class with `new PetAndGo\PetAndGo( PET_AND_GO_AUTHKEY );`.
Note: You may choose to assign it to a variable if you're going to use it right away,
but you can also create the class in your main `functions.php` file and use
`PetAndGo::get_instance();` in any templates to get the main instance.
### Getting pets list:
You can pass a species name to `get_adoptable_pets()` for a specific pet type. Currently, only "cat", "dog", or "all"
are supported.
```php
$pet_search = BigWing\PetAndGo\PetAndGo::get_instance();
$pets = $pet_search->get_adoptable_pets( 'dog' );
```