alexz707 / InvoiceNinjaModule

ZF3 Module to consume the InvoiceNinja API.


InvoiceNinjaModule

ZF3 Module to consume the InvoiceNinja API (https://www.invoiceninja.com).

GitHub release Build Status Code Coverage Scrutinizer Code Quality Dependency Status Total Downloads Latest Stable Version

Description

Latest release can handle the following api services:

  • Clients
  • Invoices
  • Products
  • Tax rates

Can use basic or digest server authorization.

Installation

The suggested installation method is via composer:

php composer.phar require alexz707/invoiceninja-module

Configure module

  • Copy /vendor/alexz707/invoiceninja-module/config/invoiceninja.global.php.dist into your global autoload folder, remove the dist extension so that Zend Framework picks it up
  • If you use your own instance of invoice ninja change the host url
  • Replace the token with your generated invoice ninja token
  • If you use basic or digest authorization uncomment the used method and fill in your credentials
    Module::INVOICE_NINJA_CONFIG => [
        Module::API_TIMEOUT     => 100,
        Module::TOKEN           => 'YOURTOKEN',
        Module::HOST_URL        => 'http://ninja.dev/api/v1',

        /*
         * If the api is protected by htaccess uncomment
         * ONE of the following code blocks and use your credentials.
         */
        Module::AUTHORIZATION   => [
            /*
             * BASIC authorization
             * \Zend\Http\Client::AUTH_BASIC => [
             *    Module::AUTH_USER => 'YOURUSER',
             *    Module::AUTH_PASS => 'YOURPASSWORD'
             * ]
             */

            /*
             * DIGEST authorization
             * \Zend\Http\ClientClient::AUTH_DIGEST => [
             *    Module::AUTH_USER => 'YOURUSER',
             *    Module::AUTH_PASS => 'YOURPASSWORD'
             * ]
             */
        ]
    ]

Enable module

Register as Zend Framework module inside your config/application.config.php file:

    'modules' => [
        'Zend\Router',
        'InvoiceNinjaModule',
        'YourApplicationModule',
    ],

Use the service managers

        /** @var ClientManager $clientManager */
        $clientManager = $sm->get(ClientManager::class);
        $client = $clientManager->getClientById(1);
No license file found for this Module
php composer.phar require "alexz707/invoiceninja-module"

Require

  • php: ^7.1
  • zendframework/zend-hydrator: ^2.2.1
  • zendframework/zend-mvc: ^3.1.0
  • zendframework/zend-filter: ^2.7.1
  • zendframework/zend-servicemanager: ^3.3
  • zendframework/zend-modulemanager: ^2.7.2

Require Dev

  • phpunit/phpunit: ^5.7
  • squizlabs/php_codesniffer: 3.0.0