Skip to content

Commit ecbe2c2

Browse files
authored
Merge pull request #4 from easybill/rest-master
Rest master
2 parents 0fda20c + 508694f commit ecbe2c2

60 files changed

Lines changed: 460 additions & 6216 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 19 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ easybill PHP SDK
33

44
[![Latest Stable Version](https://poser.pugx.org/easybill/php-sdk/v/stable.png)](https://packagist.org/packages/easybill/php-sdk) [![Total Downloads](https://poser.pugx.org/easybill/php-sdk/downloads.png)](https://packagist.org/packages/easybill/php-sdk) [![Latest Unstable Version](https://poser.pugx.org/easybill/php-sdk/v/unstable.png)](https://packagist.org/packages/easybill/php-sdk) [![License](https://poser.pugx.org/easybill/php-sdk/license.png)](https://packagist.org/packages/easybill/php-sdk)
55

6+
Switch SDK to [REST API](https://www.easybill.de/api/) **under development!**
7+
68
## Installation
79
The recommended way of installing this library is using [Composer](http://getcomposer.org/).
810

@@ -12,110 +14,31 @@ Add this repository to your composer information using the following command
1214
composer require easybill/php-sdk
1315
```
1416

15-
## Structure/ Functions
17+
## Usage
1618

17-
```
18-
// Customer
19-
Client::searchCustomers($term): Customers
20-
Client::findCustomer($customerID): Customer|null
21-
Client::findCustomerByCustomerNumber($customerNumber): Customer|null
22-
Client::createCustomer(Customer $customer): Customer
23-
Client::updateCustomer(Customer $customer): Customer
24-
Client::deleteCustomer($customerID): void
25-
26-
// Customer contact
27-
Client::findCustomerContacts(): CustomerContacts
28-
Client::findCustomerContactsByCustomer($customerID): CustomerContacts
29-
Client::findCustomerContact($contactID): CustomerContact|null
30-
Client::createCustomerContact(CustomerContact $contact): CustomerContact
31-
Client::updateCustomerContact(CustomerContact $contact): CustomerContact
32-
Client::deleteCustomerContact($contactID): void
33-
34-
// Customer group
35-
Client::findCustomerGroups(): CustomerGroups
36-
Client::findCustomerGroup($groupID): CustomerGroup|null
37-
Client::createCustomerGroup(CustomerGroup $group): CustomerGroup
38-
Client::updateCustomerGroup(CustomerGroup $group): CustomerGroup
39-
Client::deleteCustomerGroup($groupID): void
40-
41-
// Company position
42-
Client::searchCompanyPositions($term): CompanyPositions
43-
Client::findCompanyPosition($positionID): CompanyPosition|null
44-
Client::createCompanyPosition(CompanyPosition $position): CompanyPosition
45-
Client::updateCompanyPosition(CompanyPosition $position): CompanyPosition
46-
Client::deleteCompanyPosition($positionID): void
47-
48-
// Company position group
49-
Client::findCompanyPositionGroups(): CompanyPositionGroups
50-
Client::findCompanyPositionGroup($groupID): CompanyPositionGroup
51-
Client::createCompanyPositionGroup(CompanyPositionGroup $group): CompanyPositionGroup
52-
Client::updateCompanyPositionGroup(CompanyPositionGroup $group): CompanyPositionGroup
53-
Client::deleteCompanyPositionGroup($groupID): void
54-
55-
// Document
56-
Client::findDocument($documentID): Document
57-
Client::findDocumentsByDocumentNumber($documentNumber): Documents
58-
Client::findDocuments(DocumentsParams $params): Documents
59-
Client::createDocument(CreateDocument $document): DocumentCreated
60-
61-
Client::findDocumentPDF($documentID): DocumentFile
62-
Client::findDocumentPayments($documentID): Payments
63-
Client::findDocumentSent($documentID): Outbox
64-
65-
Client::createPayment(Payment $payment): boolean
66-
67-
// Reminder
68-
Client::createReminder(CreateReminder $document): DocumentCreated
69-
70-
// Dunning
71-
Client::createReminder(CreateReminder $document): DocumentCreated
19+
```php
20+
use easybill\SDK\Client;
21+
use easybill\SDK\Endpoint;
7222

73-
```
23+
$client = new Client(new Endpoint('... your API key ...'));
24+
25+
$result = $client->request('GET', 'documents');
7426

75-
## Todo
76-
- toCancelDocument()
77-
- toCreditDocument()
27+
print_r($result);
28+
```
7829

79-
## Todo new SOAP functions
80-
- upload attachments via soap
81-
- use attachment by create new document
30+
## More examples
8231

83-
## Usage
32+
Check the **examples** folder.
8433

85-
You can look into our [tests](https://github.com/easybill/php-sdk/tree/master/tests/easybill/SDK).
34+
## Documentation
8635

87-
### Setup
36+
Please see https://www.easybill.de/api for up-to-date documentation.
8837

89-
```php
90-
// create a new service client
91-
$client = new \easybill\SDK\Client('your api secret key');
38+
## Contributing
9239

93-
// If you want log (psr/log)
94-
// $client->setLogger(LoggerInterface $logger)
95-
```
40+
Please feel free to send bug reports and pull requests.
9641

97-
### Customer usage
42+
## License
9843

99-
```php
100-
// create a new customer
101-
$customer = new \easybill\SDK\Model\Customer();
102-
$customer->lastName = 'bar';
103-
$customer = $client->createCustomer($customer); // createCustomer() return a new Customer Object.
104-
$customer->customerID; // ID from customer. like 333123467
105-
$customer->customerNumber; // customerNumber from customer. like 1001
106-
107-
// update customer
108-
$customer->firstName = 'foo';
109-
try {
110-
$customer = $client->updateCustomer($customer);
111-
} catch(\easybill\SDK\Exception\CustomerNotFoundException $exception) {
112-
// customer not found!
113-
// if customerID is missing or wrong.
114-
}
115-
116-
// search customer
117-
$customers = $client->searchCustomers('bar');
118-
foreach ($customers as $customer) {
119-
$customer->customerID;
120-
}
121-
```
44+
Published as open source under the terms of [MIT License](http://opensource.org/licenses/MIT).

composer.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
{
22
"name": "easybill/php-sdk",
3-
"description": "easybill PHP SDK (SOAP API)",
3+
"description": "easybill PHP SDK (API)",
44
"keywords": [
5-
"PHP", "easybill", "API", "SDK", "SOAP"
5+
"PHP",
6+
"easybill",
7+
"API",
8+
"SDK",
9+
"REST"
610
],
711
"type": "library",
8-
"minimum-stability": "dev",
12+
"minimum-stability": "stable",
913
"license": "MIT",
1014
"homepage": "https://www.easybill.de",
1115
"authors": [
@@ -15,17 +19,13 @@
1519
}
1620
],
1721
"require": {
18-
"php": ">=5.3.0",
19-
"ext-soap": "*",
20-
"doctrine/collections": "~1.2",
21-
"psr/log": "~1.0"
22-
},
23-
"require-dev": {
24-
"phpunit/phpunit": "~4.6"
22+
"php": ">=5.5",
23+
"guzzlehttp/guzzle": "~6.0",
24+
"ext-json": "*"
2525
},
2626
"autoload": {
2727
"psr-4": {
28-
"easybill\\SDK\\": "easybill/SDK/"
28+
"easybill\\SDK\\": "src/"
2929
}
3030
}
3131
}

0 commit comments

Comments
 (0)