Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mordisacks/priority-api
A PHP client for priority software API
https://github.com/mordisacks/priority-api
Last synced: 4 days ago
JSON representation
A PHP client for priority software API
- Host: GitHub
- URL: https://github.com/mordisacks/priority-api
- Owner: MordiSacks
- License: mit
- Created: 2020-01-30T13:38:21.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-04-19T19:26:42.000Z (over 1 year ago)
- Last Synced: 2024-09-19T20:48:17.829Z (about 2 months ago)
- Language: PHP
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# priority-api
A PHP client for priority software API
based on this documentation
https://prioritysoftware.github.io/restapi/### Instellation
`composer require mordisacks/priority-api`### Usage
#### Setup
```php
$client = new PriorityClient($serviceRootUrl);
```#### Authentication
```php
// Basic auth
$client->withBasicAuth('username', 'password');// App auth
$client->withAppAuth('app_id', 'app_key');
``````php
$query = new Builder();
$query->setClient($client);
```#### Getting a collection
```php
$query->from('ORDER')
->select('A', 'B', 'C')
->filter('FOO', 'bar')
->orFilter('FOO', '!=', 'BAZ')
->expand('ITEMS_SUBFORM')
->top(3);
// Outputs the raw query: ORDER?$select=A,B,C&$filter=FOO eq 'bar' or FOO ne 'BAZ'&$expand=ITEMS_SUBFORM&$top=3
$query->toQuery();// Returns a collection of ORDERS
$query->get();
```#### Gettign a single Entity
```php
// Returns a single ORDER with the id of AA123456
$query->from('ORDERS')->find('AA123456');
```#### Filter Group
```php
$query->filter(function (Filter $filter) {
$filter->filter('B', 'something');
$filter->filter('C', 'something');
});
```#### Expand sub query
```php
$query->expand('ITEMS', function (Builder $q) {
$q->select('FIELD1', 'FIELD2', 'FIELD3')
->filter('FIELD1', 'Y')
->filter(function (Filter $filter) {
$filter->filter('FIELD2', 'Y')
->orFilter('FIELD3', 'Y');
});
});
```
--------------Inspired by Laravel Eloquant builder