Download the PHP package albawebstudio/petfinder-api without Composer
On this page you can find all versions of the php package albawebstudio/petfinder-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download albawebstudio/petfinder-api
More information about albawebstudio/petfinder-api
Files in albawebstudio/petfinder-api
Package petfinder-api
Short Description Laravel package to incorporate Petfinder API
License MIT
Informations about the package petfinder-api
Petfinder API helper for New Leash Rescue website
These library will help you with the usage of Petfinder API.
Installation
Require this package with composer. It is recommended to only require the package for development.
Laravel uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
Laravel without auto-discovery:
If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php
You can also set in your config with Petfinder API key, API secret and organization ID with .env vars.
Copy the package config to your local config with the publish command:
Using in Laravel Project
You can implement the requests using the following instructions.
Update .env
Append the following to the end of your .env
file. You can find the API access information in the
Developer Settings of your Petfinder account.
You can fetch your organization ID in several ways. Look at the animal shelter and rescue
page and search for your organization. In the "shelter search results", hover over the search icon in the "Pet List"
column. Your organization ID is the value after shelter_id=
.
For example, if you hover over and see the following URL https://www.petfinder.com/pet-search?shelter_id=MN452
, your
organization ID is MN452
.
Create a new controller for making the API requests. Our example we have created a controller PetfinderApiController
.
The next step is to generate a new controller for fetching the animals
data. We created a controller AnimalController
.
*Note: The controller will extend the PetfinderApiController
.
The AnimalController
has the methods necessary to find all the animal information currently available through the
Petfinder API. Be sure to check out all the query parameters
available.
You have the option to generate a new controller for fetching the organizations
data. We created a controller
OrganizationController
.
*Note: The controller will extend the PetfinderApiController
.
The OrganizationController
has the methods necessary to find all the organizations currently available through the
Petfinder API. Be sure to check out all the query parameters
available.
API Routes
Here is an example of how to set up the API routes. Added the following to routes/api.php