Download the PHP package bluerock/sellsy-client without Composer
On this page you can find all versions of the php package bluerock/sellsy-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bluerock/sellsy-client
More information about bluerock/sellsy-client
Files in bluerock/sellsy-client
Package sellsy-client
Short Description A lightweight PHP client to query the Sellsy API V2
License MIT
Informations about the package sellsy-client
Sellsy API V2 PHP client
- Introduction
- Installation
- Usage
- Authenticate
- Query the API
- The basics
- Requests
- Responses
- Examples
- Developments status
- Contribute
- Credits
- License
Introduction
This package is a PHP client for the Sellsy API. It's a light wrapper around the Guzzle HTTP client. It's designed to be as simple as possible to use, while being robust.
The client only supports the V2 of Sellsy API. If you're looking for a V1 client, checkout TeknooSoftware/sellsy-client instead.
To ensure a consistent data exchange between Sellsy and this client, we're making use of DTO classes to define the structure of the shared entities. Thoses classes are defined in the Bluerock\Sellsy\Entities
namespace :
This also mean you will get back DTO entities from the Sellsy API when performing GET requests :
If you're unfamiliar with DTOs or need some documentation on it, make sure to have a look at the spatie/data-transfer-object package, used by this client.
Please keep in mind that this package is still in development. If you're missing an contribute or open an issue on this repository.
Installation
Requirements
- PHP
>= 7.4
- Composer
Installation via composer
Usage
Authenticate
This package supports the following authentication methods :
- "Personnal" OAuth client credentials
Before querying Sellsy API, you must provide your credentials using the Config
class :
Learn more about Sellsy API v2 credentials on the official documentation.
Connect to multiple Sellsy accounts
You can connect to many Sellsy accounts at the same time. You just need to configure each instance,
then switch to one or another with Config::switchInstance()
(returns a Config
object for that specific account)
Querying the API
The basics
Each API domain is represented by a plurialized class (eg: Contacts
, Items
, Taxes
). Each class contains methods used to perform requests agaisn't the domain's endpoints.
The easiest way to start querying the API is by initializing the corresponding class :
You may also make use of the Client
facade that holds all domains to easily instanciate the corresponding class by calling a method :
Requests
This client is using the Laravel CRUD operations keywords to name methods :
HTTP Operation | Client Method | Related operation |
---|---|---|
GET | index |
List resources. |
GET | show |
Get a single resource. |
POST | create |
Create a single resource. |
UPDATE | update |
Update a single resource. |
DELETE | destroy |
Delete a single resource. |
GET | search |
Search resources. |
Any additional method described in the domain's documentation would follow the camel case convention. For example, additional Companies methods would look like this :
Operation | Client Method |
---|---|
Get a company address. | CompaniesApi::showAddress(...) |
Update a company address. | CompaniesApi::updateAddress(...) |
Link a contact at one company. | CompaniesApi::linkContact(...) |
Responses
When issuing a request, you will get back a Bluerock\Sellsy\Core\Response
object holding methods to verify and read the response.
You can inspect the response using any of those methods :
By default, the Request will throw a RequestException
if the request returns an error (status code 4xx —> 5xx
). You can easily catch this exception and handle it as you wish :
Some notes on response & DTOs
To retrieve the DTO entities from the Response, you may call one of entity()
and entities()
methods :
If some additionnal entities are embed in the response, they will be automatically parsed into subsequent DTOs.
If you need to read the raw response, it is always possible to use the json()
method :
Examples
Index
Listing a resource, is done by using the index()
method, which accept query parameters as only argument.
Show
The show method accept the resource id as first parameter and query parameters as second :
This would return a Bluerock\Sellsy\Entities\Contact
instance :
Create
The store method, used to create a resource, expect the entity object as first argument and may have $query
parameters as second argument :
Update
The update method expect the resource to be updated as first parameter and $query
parameters as second argument :
Here, the "id" parameter is extracted from the given Contact entity.
Delete
When deleting a resource, the destroy method should be called. This method only expect the resource id to be deleted :
Developments status
✅ = Fully implemented
🆚 = Partially implemented
🅾️ = Not yet implemented
Category | Domain | Status |
---|---|---|
Core | Batch | 🅾️ |
Core | API Management | 🅾️ |
Core | Webhooks | 🅾️ |
Core | Listings | 🅾️ |
Core | Activities | 🅾️ |
Core | Custom Activities | 🅾️ |
Core | Files | 🅾️ |
Prospection | Companies | ✅ |
Prospection | Contacts | ✅ |
Prospection | Individuals | ✅ |
Prospection | Opportunities | 🅾️ |
Prospection | Calendar | 🅾️ |
Prospection | Emails | 🅾️ |
Prospection | Comments | 🅾️ |
Prospection | Tasks | 🅾️ |
Prospection | PhoneCalls | 🅾️ |
Prospection | CRM Activities | 🅾️ |
Prospection | Estimates | 🅾️ |
Catalog | Items | 🆚️ |
Catalog | Units | ✅ |
Catalog | Taxes | ✅ |
Invoicing | Accounting | 🅾️ |
Invoicing | Rate Categories | ✅ |
Invoicing | Purchase (OCR) | 🅾️ |
Invoicing | Payments | 🅾️ |
Invoicing | Invoices | 🆚️ |
Invoicing | Credit Notes | 🅾️ |
Account | Currencies | 🅾️ |
Account | Custom Fields | 🅾️ |
Account | Countries | 🅾️ |
Account | Smart Tags | 🅾️ |
Account | Documents | 🅾️ |
Account | Staffs | 🅾️ |
Account | Subscription | 🅾️ |
Account | Quotas | 🅾️ |
Account | Conformities | 🅾️ |
Account | Notifications | 🅾️ |
Account | Fiscal Year | 🅾️ |
Contribute
Feel free to contribute to the package !
If you find any security issue, please contact me at [email protected] instead of creating a public github issue.
Credits
- BlueRockTEL
- Thomas Georgel
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of sellsy-client with dependencies
illuminate/support Version >=8.0
illuminate/http Version >=8.0
illuminate/contracts Version >=8.0
guzzlehttp/guzzle Version ^7.0
spatie/data-transfer-object Version ^2.0