MFクラウド請求書API client library for PHP
This library is inspired by moneyforward/mf_cloud-invoice-ruby
composer require traimmu/mf-cloud-invoice
use Traimmu\MfCloud\Invoice\Client;
$client = new Client('YOUR_ACCESS_TOKEN');
$client->billings()->all();
// => your billings
$office = $client->office(); // => returns Traimmu\MfCloud\Invoice\Models\Office instance
echo $office->name; // => '株式会社Traimmu'
$office->update([
'name' => 'section9',
'zip' => '101-1111',
]);
echo $office->name; // => 'section9'
$client->partners()->all();
$client->partners()->find('MF INVOICE PARTNER ID');
$client->billings()->all();
$client->items()->all();
Add the Traimmu\MfCloud\Invoice\Misc\ServiceProvider
provider to the providers
array in config/app.php
:
'providers' => [
// ...
Traimmu\MfCloud\Invoice\Misc\ServiceProvider::class,
],
Then add the facade to your aliases
array:
'aliases' => [
// ...
'Invoice' => Traimmu\MfCloud\Invoice\Misc\Facade::class,
],
Finally, add the following lines at config/services.php
:
// ...
'mfcloud' => [
'secret' => env('MFCLOUD_INVOICE_API_TOKEN'),
],
Get partners which have more than one departments:
<?php
$client->partners()->all()->filter(function ($partner) {
return count($partner->departments) > 0;
});
- Add tests
- client
- api
- models
- Add service provider for Laravel
- Add Eloquent model like methods and relationships
- api->firstOrCreate()
- Create Department model
-
$client->partners()->first()->departments()->create($params)
-
$client->partners()->first()->departments->first()
- Partner hasMany Departments
- Department hasMany Billings
- Billing hasMany Items
- Add Exceptions
- Add circle.yml and build automatically
- Add more documents
- Add authentication for getting OAuth token
After checking out the repo, run composer install
to install dependencies.
Then run vendor/bin/phpunit
and ensure all tests success.
Bug reports and pull requests are welcome on GitHub at https://github.com/Traimmu/mf_cloud-invoice-php
The package is available as open source under the terms of the MIT License.