Harvest API
A Laravel wrapper for theInstall
composer require byte5digital/laravel-harvest
If you want to persist harvest data, publish the migration:
php artisan vendor:publish --provider="Byte5\LaravelHarvest\LaravelHarvestServiceProvider
If you only want to publish the config file add: --tag="config"
Table of Content
Usage
You can use either the Harvest
facade or the Api Manager for any request.
// instantiate api manager
$manager = app()->make('harvest');
// get Clients with Facade
$result = Harvest::getClients();
// get Clients via ApiManager
$result = $manager->clients->all();
// get Clients by Id
Harvest::getClientsById('12345');
$manager->clients->id('12345');
// get Clients with Facade
$result = Harvest::getCompany();
// get Clients via ApiManager
$result = $manager->company->all();
// get Contacts with Facade
$result = Harvest::getContacts();
// get Contacts via ApiManager
$result = $manager->contacts->all();
// get Contacts by Id
Harvest::getContactsById('12345');
$manager->contacts->id('12345');
// get Estimates with Facade
$result = Harvest::getEstimates();
// get Estimates via ApiManager
$result = $manager->estimates->all();
// get Estimate by Id
Harvest::getEstimateById('12345');
$manager->estimates->id('12345');
// get Expenses with Facade
$result = Harvest::getExpenses();
// get Expenses via ApiManager
$result = $manager->expenses->all();
// get Expense by Id
Harvest::getExpenseById('12345');
$manager->expenses->id('12345');
// get Expense Category with Facade
Harvest::getExpenseCategorie);
// get Expense Category via ApiManager
$result = $manager->expenses->al);
// get Expense Category by Id
Harvest::getExpenseCategoryById('12345');
$manager->expenseCategory->id('12345');
// get Users with Facade
$result = Harvest::getUsers();
// get Users via ApiManager
$result = $manager->users->all();
// get Users by Id
Harvest::getUsersById('12345');
$manager->users->id('12345');
// get current user
Harvest::getCurrentUser();
$manager->user->me();
$result = Harvest::getUsers();
// convert result to json
$result->toJson();
// convert result to collection
$result->toCollection();
// convert result to paginated collection
$result->toPaginatedCollection();
// get next result page
$result = $result->next();
// get prev result page
$result = $result->previous();
ToDo
- add usage sections to readme
- update/create records
- tests
Testing
Run the tests with:
vendor/bin/phpunit
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.