homedoctor-es / holded-php-sdk
A PHP package to access the Holded API by a comprehensive way.
Installs: 2 152
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 2
Open Issues: 0
Requires
- php: >=7.0
- guzzlehttp/guzzle: ~6.0
Requires (Dev)
- phpunit/phpunit: ~7.0
- vlucas/phpdotenv: *
README
A PHP package to access the Holded API by a comprehensive way
Installation
The preferred way to install this extension is through composer.
With Composer installed, you can then install the extension using the following commands:
$ php composer.phar require homedoctor-es/holded-php-sdk
or add
... "require": { "homedoctor-es/holded-php-sdk": "*" }
to the require
section of your composer.json
file.
Configuration
You can set the HOLDED_API_TOKEN as environment variables or add them later on Holded class instantiation.
The name of the environment var is HOLDED_API_KEY.
Usage
Endpoints calls must done through the Holded class.
If you haven't set the environment variable previously, remember to provide the key on instantiation.
$holded = new \HomedoctorEs\Holded\Holded($holdedApiKey); // or Holded::make($holdedApiKey) $holded->contact()->list();
Endpoints
At this moment, only can be managed 2 entities with this SDK: contacts and documents
Contacts
To check contacts entity requirements and fields, you can see https://developers.holded.com/reference#contacts
The contacts entity use these methods
$holded->contact()->list(); $holded->contact()->get($id); $holded->contact()->create($data); //$data = [] $holded->contact()->update($data); //$data = [] $holded->contact()->delete($id);
Documents
To check documents entity requirements and fields, you can see https://developers.holded.com/reference#documents
The contacts entity use these methods
$holded->document()->list(); $holded->document()->get($id); $holded->document()->create($data); //$data = [] $holded->document()->update($data); //$data = [] $holded->document()->delete($id); //$data = []
"docType" default value is invoice, if you want to instantiate another kind of document, you can pass docType param to document method
$document = $holded->document(Document::PURCHASE_ORDER);
Check Document class constants to see the kind of docType you can use
If you want to instantiate directly and invoice document you can do it using ->invoice() method
$invoice = $holded->invoice();