Code Monkey home page Code Monkey logo

mf-cloud-invoice's Introduction

Latest Stable Version Latest Unstable Version License Monthly Downloads CircleCI

mf_cloud-invoice-php

MFクラウド請求書API client library for PHP

This library is inspired by moneyforward/mf_cloud-invoice-ruby

Installation

composer require traimmu/mf-cloud-invoice

Usage

Build client

use Traimmu\MfCloud\Invoice\Client;

$client = new Client('YOUR_ACCESS_TOKEN');

$client->billings()->all();
// => your billings

Get My Office

$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'

Get Partners

$client->partners()->all();
$client->partners()->find('MF INVOICE PARTNER ID');

Get Billings

$client->billings()->all();

Items

$client->items()->all();

Laravel Integration

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'),
],

Example

Get partners which have more than one departments:

<?php
$client->partners()->all()->filter(function ($partner) {
  return count($partner->departments) > 0;
});

Loadmap

  • 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

Development

After checking out the repo, run composer install to install dependencies.

Then run vendor/bin/phpunit and ensure all tests success.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Traimmu/mf_cloud-invoice-php

License

The package is available as open source under the terms of the MIT License.

mf-cloud-invoice's People

Contributors

acro5piano avatar grkztd avatar yppon avatar ef-tech avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.