Download the PHP package onfleet/php-onfleet without Composer
On this page you can find all versions of the php package onfleet/php-onfleet. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download onfleet/php-onfleet
More information about onfleet/php-onfleet
Files in onfleet/php-onfleet
Package php-onfleet
Short Description Onfleet's PHP API Wrapper Package
License MIT
Homepage https://onfleet.com/
Informations about the package php-onfleet
Onfleet PHP Wrapper
Read this document in another language: Español
Visit our blog post on the API wrapper project to learn more about our initiatives. If you have any questions, please reach us by submitting an issue here or contact [email protected].
Table of contents
- Table of contents
- Synopsis
- Installation
- Requirements
- Usage
- Authentication
- Throttling
- Supported CRUD operations
- GET Requests
- Examples of
get()
- Examples of
get(param)
- Examples of
getByLocation
- Examples of
- POST Requests
- Examples of
create()
- Examples of
- PUT Requests
- Examples of
update()
- Examples of
insertTask()
- Examples of
- DELETE Requests
- Examples of
deleteOne()
- Examples of
- Examples of utilizing your CRUD operations
- Things NOT to do
Synopsis
The Onfleet PHP library provides convenient access to the Onfleet API.
Installation
Requirements
The Onfleet PHP library requires bcmath extension to be installed.
Usage
Before using the API wrapper, you will need to obtain an API key from one of your organization's admins.
Creation and integration of API keys are performed through the Onfleet dashboard.
To start utilizing the library, you simply need to create an Onfleet
object with your API key:
Optionally, you can introduce a customized timeout that is less than the default Onfleet API timeout (70,000 ms) by providing a 2nd parameter:
Authentication
Once the Onfleet
object is created, you can test on the authentication endpoint:
Throttling
Rate limiting is enforced by the API with a threshold of 20 requests per second across all your organization's API keys. Learn more about it here.
We have also implemented a limiter on this library to avoid you from unintentionally exceeding your rate limitations and eventually be banned for.
Supported CRUD Operations
Here are the operations available for each entity:
Entity | GET | POST | PUT | DELETE |
---|---|---|---|---|
Admins/Administrators | get() | create(obj), matchMetadata(obj) | update(id, obj) | deleteOne(id) |
Containers | get(id, 'workers'), get(id, 'teams'), get(id, 'organizations') | x | update(id, obj) | x |
Destinations | get(id) | create(obj), matchMetadata(obj) | x | x |
Hubs | get() | create(obj) | update(id, obj) | x |
Organization | get(), get(id) | x | insertTask(id, obj) | x |
Recipients | get(id), get(name, 'name'), get(phone, 'phone') | create(obj), matchMetadata(obj) | update(id, obj) | x |
Tasks | get(query), get(id), get(shortId, 'shortId') | create(obj), clone(id), forceComplete(id), batch(obj), autoAssign(obj), matchMetadata(obj) | update(id, obj) | deleteOne(id) |
Teams | get(), get(id), getWorkerEta(id, obj), getTasks(id) | create(obj), autoDispatch(id, obj) | update(id, obj), insertTask(id, obj) | deleteOne(id) |
Webhooks | get() | create(obj) | x | deleteOne(id) |
Workers | get(), get(query), get(id), getByLocation(obj), getSchedule(id), getTasks(id) | create(obj), setSchedule(id, obj), matchMetadata(obj), getDeliveryManifest(obj) | update(id, obj), insertTask(id, obj) | deleteOne(id) |
Custom Fields | get(query) | create(obj) | update(obj) | delete(obj) |
GET Requests
To get all the documents within an endpoint, this returns an array of results:
Examples of get()
Optionally you can send an array of query params for some certain endpoints. Refer back to API documentation for endpoints that support query parameters.
To get one of the documents within an endpoint, if the optional paramName is not provided, the library will search by ID. If paramName is provided, it will search by paramName:
paramName can be any of:
id
name
phone
shortId
Examples of get(param)
To get a driver by location, use the getByLocation
function:
Examples of getByLocation
POST Requests
To create a document within an endpoint:
Examples of create()
Examples of getDeliveryManifest()
Extended POST requests include clone
, forceComplete
, batchCreate
, autoAssign
on the Tasks endpoint; setSchedule
on the Workers endpoint; autoDispatch
on the Teams endpoint; and matchMetadata
on all supported entities. For instance:
For more details, check our documentation on clone
, forceComplete
, batchCreate
, autoAssign
, setSchedule
, matchMetadata
, getDeliveryManifest
, and autoDispatch
.
PUT Requests
To update a document within an endpoint:
Examples of update()
Examples of insertTask()
DELETE Requests
To delete a document within an endpoint:
Examples of deleteOne()
Examples of utilizing your CRUD operations
- Get all the recipients:
Things NOT to do
- Inefficient pattern, use metadata instead:
Go to top.