# Installation

The Accountant package can be easily installed via Composer (opens new window).

The latest version brings support for Laravel (opens new window) & Lumen (opens new window) 8.0 and up.

To install the package, execute the following command on your project root:

composer require altek/accountant

# Version matrix

Version Illuminate Status PHP Version
3.x 8.x.y - 9.x.y Latest >= 7.3.0
2.x 7.x.y EOL >= 7.2.5
1.x 5.2.x - 6.x.y EOL >= 7.1.3

# Configuration

There's a slight difference between the Laravel and Lumen configurations, so we cover them both.

# Laravel

Edit the config/app.php file and add the following line to register the service provider:

'providers' => [
    // ...

    Altek\Accountant\AccountantServiceProvider::class,

    // ...
],

TIP

While the service provider setup instructions are still included, from Laravel 5.5 onward this step can be skipped in favour of the Package Auto-Discovery (opens new window) feature.

# Lumen

Add the following line to register the service provider in the bootstrap/app.php file:

// ...

$app->register(Altek\Accountant\AccountantServiceProvider::class);

// ...

Also in the bootstrap/app.php file, enable Facades and Eloquent:

// ...

$app->withFacades();

$app->withEloquent();

// ...

Finally, the configuration file must be loaded into the application by adding the following line to bootstrap/app.php:

// ...

$app->configure('accountant');

// ...

The vendor:publish command is not natively available in Lumen, so an extra package must be installed:

composer require laravelista/lumen-vendor-publish

Once installed, register the new command in app/Console/Kernel.php:

// ...

protected $commands = [
    \Laravelista\LumenVendorPublish\VendorPublishCommand::class,
];

// ...

NOTICE

The service provider registration is mandatory in order to publish the configuration and migration files!

# Publishing

After your framework of choice has been configured, publish the configuration file using the following command:

php artisan vendor:publish --tag="accountant-configuration"

This will create the config/accountant.php configuration file.

You can read more about the available configuration settings in the Configuration section.

# Database

Publish the database migration files with the following command:

php artisan vendor:publish --tag="accountant-migrations"

# Customisation

If needed, the ledgers table can be customised.

Read more about it in the Ledger Table section.

# Migration

Once the previous steps has been done, execute the following artisan command to run the migration:

php artisan migrate

This will create the ledgers table in your database.

# User model

In order to use this package, the User model needs to implement the Altek\Accountant\Contracts\Identifiable interface.

Please refer to the Identifiable implementation section for details.

# Resolvers

Read more about this subject in the Resolvers section!