Download the PHP package byte5digital/laravel-harvest without Composer
On this page you can find all versions of the php package byte5digital/laravel-harvest. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download byte5digital/laravel-harvest
More information about byte5digital/laravel-harvest
Files in byte5digital/laravel-harvest
Package laravel-harvest
Short Description A Laravel wrapper for the Harvest API.
License MIT
Informations about the package laravel-harvest
A Laravel wrapper for the Harvest API
A small wrapper for the harvest API which aims to make your life more easier.
Currently it is only possible to receive data from harvest with this package but not to create content.
Install
Laravel Version 5.6+
composer require byte5digital/laravel-harvest
Laravel Version 5.5
composer require byte5digital/laravel-harvest:2.0
If you want to store harvest data into your database, set the uses_database
in the harvest
config to true
and publish the migrations:
php artisan vendor:publish --provider="Byte5\LaravelHarvest\LaravelHarvestServiceProvider"
If you only want to publish the config file add: --tag="config"
Usage
You can use either the Harvest
Facade or resolve the ApiManager
out of the ioc container.
Getting Data
Every Api call looks like this:
You can either grab the results with get()
or find($id)
There are some cases which have different methods, because they rely on other objects.
List of exceptions:
- EstimateMessage
- InvoiceMessage
- InvoicePayment
- ProjectAssignment
- TaskAssignment
- UserAssignment
Handling Responses
Api responses can be either converted into json
, a collection
or a paginated collection
which is basically json
combined with collection
.
Handle Pagination
By default harvest gives back a JSON-response with up to 100 records. If you want to limit your results you should use
limit()
. If you want results from a specific page just pipe fromPage()
before find
or get
.
If your harvest entries exceeds 100 records and you just want to get the results from the next or previous page,
you may call next()
on the result to get to the next 100 results.
Additional Params
Adding additional params to your requests is also possible. Not every param is supported yet
supported params:
is_active
=>active()
Some Api Calls allow you to have different params:
Loading External Relations
When you query the API for any object which has external relations, you might want to checkout the loadExternal()
method to get those relations loaded locally.
ToDo
- update/create records
- improve tests
Testing
Run the tests with:
Upgrading
Please see UPGRADING for details.
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.