-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7dac5fd
Showing
47 changed files
with
3,983 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml}] | ||
indent_size = 2 | ||
|
||
[docker-compose.yml] | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/vendor/ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Copyright 2021 David Villa ([email protected]) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software | ||
and associated documentation files (the "Software"), to deal in the Software without restriction, | ||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial | ||
portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT | ||
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Fortnox API Client for Laravel | ||
|
||
Simplifies integration with the Fortnox API. | ||
|
||
*Please notice! This package does not yet support all available resources in the Fortnox API* | ||
|
||
## Requirements | ||
|
||
- Laravel 6 or higher | ||
- PHP 8.0 or higher | ||
- Valid client id (from Fortnox) | ||
- Valid client secret (from Fortnox) | ||
- Valid refresh token (from Fortnox) | ||
|
||
## Installation | ||
|
||
You can install the package via Composer: | ||
|
||
` | ||
composer require kfoobar/laravel-fortnox | ||
` | ||
|
||
## Settings for .env | ||
|
||
``` | ||
FORTNOX_CLIENT_ID= | ||
FORTNOX_CLIENT_SECRET= | ||
FORTNOX_REFRESH_TOKEN= | ||
``` | ||
|
||
## Fortnox authorization | ||
|
||
In order to use the Fortnox API, you need a valid refresh token. | ||
To get a refresh token, you need to grant access to the integration via Fortnox's OAuth2 | ||
authorization code flow. In that process, you are assigned an *authorization code* | ||
that you can use to exchange for a pair of token: | ||
|
||
The **access token** - which is used to authenticate all API request - is only valid | ||
for 1 hour and needs to be refreshed using a refresh token. This package handles | ||
that process as long you have a valid refresh token. | ||
|
||
The **refresh token** - which is used to renew the access token - is valid for 30 days. | ||
If it expires, you need to redo the OAuth2 authorization flow. | ||
|
||
Every time you renew you access token, you will be assigned a new refresh token that | ||
is valid for another 30 days. It is therefore important that you regularly renew | ||
the tokens so that the refresh token does not expire. | ||
|
||
You can renew your tokens with the following command: | ||
|
||
``` | ||
php artisan fortnox:refresh | ||
``` | ||
|
||
*Both the access token and the refresh token are stored in your application's cache. | ||
Keep this in mind when you purge the cache or changes cache driver.* | ||
|
||
## Instructions | ||
|
||
Coming soon... | ||
|
||
## Contributing | ||
|
||
Contributions are welcome! | ||
|
||
## License | ||
|
||
The MIT License (MIT). Please see [License File](LICENSE) for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "kfoobar/laravel-fortnox", | ||
"description": "Fortnox API Client for Laravel", | ||
"keywords": ["laravel", "fortnox", "bookkeep", "api"], | ||
"license": "MIT", | ||
"type": "project", | ||
"require": { | ||
"php": "^8", | ||
"ext-json": "*", | ||
"illuminate/console": ">=6", | ||
"illuminate/support": ">=6" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"KFoobar\\Fortnox\\": "src/" | ||
} | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "David Villa", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"KFoobar\\Fortnox\\FortnoxServiceProvider" | ||
], | ||
"aliases": { | ||
"Fortnox": "KFoobar\\Fortnox\\Facades\\Fortnox" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.