Skip to content

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
  • Loading branch information
dominik-wbz committed Sep 8, 2019
1 parent 204f73e commit fd2b7bd
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 9 deletions.
79 changes: 78 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,78 @@
TODO
# Laravel Fakturoid

Simple wrapper for official php package https://github.com/fakturoid/fakturoid-php

### Docs

- [Installation](#installation)
- [Configuration](#configuration)
- [Examples](#examples)

## Installation

### Step 1: Install package

Add the package in your composer.json by executing the command.

```bash
composer require dominik-wbz/laravel-fakturoid
```

This will both update composer.json and install the package into the vendor/ directory.

Next, add the service provider and facade to `config/app.php`

Add the service provider to providers:

```
'providers' => [
...
WEBIZ\LaravelFakturoid\FakturoidServiceProvider::class,
...
]
```

And add the facade to aliases:

```
'aliases' => [
...
'Fakturoid' => WEBIZ\LaravelFakturoid\Facade::class,
...
]
```

### Step 2: Configuration

First initialise the config file by running this command:

```bash
php artisan vendor:publish
```

With this command, initialize the configuration and modify the created file, located under `config/fakturoid.php`.

## Configuration

```php
return [
'account_name' => 'XXX',
'account_email' => 'XXX',
'account_api_key' => 'XXX',
'app_contact' => 'PHPlib <your@email.cz>',
];
```

## Examples

### Create Subject

```php

\Fakturoid::createSubject(array('name' => 'Firma s.r.o.', 'email' => 'aloha@pokus.cz'));

```

## License

Copyright (c) 2019 webiz eu s.r.o MIT Licensed.
17 changes: 12 additions & 5 deletions src/LaravelFakturoid.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ class LaravelFakturoid {

public function __construct() {
$this->config = [
'app_name' => config('fakturoid.app_name'),
'app_email' => config('fakturoid.app_email'),
'app_api_key' => config('fakturoid.app_api_key'),
'account_name' => config('fakturoid.app_name'),
'account_email' => config('fakturoid.app_email'),
'account_api_key' => config('fakturoid.app_api_key'),
'app_contact' => config('fakturoid.app_contact'),
];
$this->initFakturoid();
Expand All @@ -22,8 +22,15 @@ protected function initFakturoid() {
return $this->fakturoid;
}

public function gooo() {
dd($this);
public function __call($name, $arguments) {
if (method_exists($this, $name)) {
return $this->{$name}(...$arguments);
} else if (method_exists($this->fakturoid, $name)) {
$fakturoid = $this->fakturoid;
$methodResult = $fakturoid->{$name}(...$arguments);
return $methodResult;
}
return null;
}

}
6 changes: 3 additions & 3 deletions src/config.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
return [
'app_name' => 'XXX',
'app_email' => 'XXX',
'app_api_key' => 'XXX',
'account_name' => 'XXX',
'account_email' => 'XXX',
'account_api_key' => 'XXX',
'app_contact' => 'PHPlib <your@email.cz>',
];

0 comments on commit fd2b7bd

Please sign in to comment.