-
Notifications
You must be signed in to change notification settings - Fork 0
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 8fa77ec
Showing
25 changed files
with
2,493 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,5 @@ | ||
/vendor | ||
composer.phar | ||
composer.lock | ||
.DS_Store | ||
.idea |
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,15 @@ | ||
language: php | ||
|
||
php: | ||
- 7.2 | ||
- 7.3 | ||
- 7.4 | ||
- 8.0 | ||
|
||
before_script: | ||
- curl -s http://getcomposer.org/installer | php | ||
- php composer.phar install --dev | ||
|
||
script: | ||
- ./vendor/bin/phpcs --standard=phpcs.xml src | ||
- ./vendor/bin/phpstan --level=0 --no-progress analyse src |
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,11 @@ | ||
The BSD 2-Clause License | ||
Copyright (c) 2016-2020, Daniel Stainback | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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 @@ | ||
# currency |
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,57 @@ | ||
{ | ||
"name": "forexapi/currency", | ||
"description": "This provides Laravel with currency functions such as currency formatting and conversion using up-to-date exchange rates.", | ||
"keywords": [ | ||
"laravel", | ||
"currency", | ||
"money", | ||
"exchange rate", | ||
"OpenExchangeRates", | ||
"Exchange Rates API", | ||
"finance" | ||
], | ||
"license": "BSD-2-Clause", | ||
"authors": [ | ||
{ | ||
"name": "Daniel Stainback", | ||
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "CHapdel KAMGA", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": "^7.2|^8.0", | ||
"illuminate/support": "^6.0|^7.0|^8.0", | ||
"illuminate/console": "^6.0|^7.0|^8.0", | ||
"illuminate/cache": "^6.0|^7.0|^8.0" | ||
}, | ||
"suggest": { | ||
"illuminate/database": "Allows for storing of currencies in the database" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^8.0", | ||
"mockery/mockery": "^1.3", | ||
"phpstan/phpstan": "^0.12.14", | ||
"squizlabs/php_codesniffer": "^3.5" | ||
}, | ||
"autoload": { | ||
"files": [ | ||
"src/helpers.php" | ||
], | ||
"psr-4": { | ||
"ForexAPI\\Currency\\": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"ForexAPI\\Currency\\CurrencyServiceProvider" | ||
], | ||
"aliases": { | ||
"Currency": "ForexAPI\\Currency\\Facades\\Currency" | ||
} | ||
} | ||
} | ||
} |
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,121 @@ | ||
<?php | ||
|
||
return [ | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Application Currency | ||
|-------------------------------------------------------------------------- | ||
| | ||
| The application currency determines the default currency that will be | ||
| used by the currency service provider. You are free to set this value | ||
| to any of the currencies which will be supported by the application. | ||
| | ||
*/ | ||
|
||
'default' => 'USD', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| API Key for FOREXAPI | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Only required if you with to use the Open Exchange Rates api. You can | ||
| always just use Yahoo, the current default. | ||
| | ||
*/ | ||
|
||
'api_key' => env( | ||
"FOREXAPI_KEY", | ||
), | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Default Storage Driver | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may specify the default storage driver that should be used | ||
| by the framework. | ||
| | ||
| Supported: "database", "filesystem", "Model" | ||
| | ||
*/ | ||
|
||
'driver' => 'model', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Default Storage Driver | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may specify the default cache driver that should be used | ||
| by the framework. | ||
| | ||
| Supported: all cache drivers supported by Laravel | ||
| | ||
*/ | ||
|
||
'cache_driver' => null, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Storage Specific Configuration | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may configure as many storage drivers as you wish. | ||
| | ||
*/ | ||
|
||
'drivers' => [ | ||
|
||
'database' => [ | ||
'class' => \ForexAPI\Currency\Drivers\Database::class, | ||
'connection' => null, | ||
'table' => 'currencies', | ||
], | ||
|
||
'filesystem' => [ | ||
'class' => \ForexAPI\Currency\Drivers\Filesystem::class, | ||
'disk' => null, | ||
'path' => 'currencies.json', | ||
], | ||
|
||
'model' => [ | ||
'table' => 'currencies', | ||
'class' => Currency::class | ||
], | ||
|
||
], | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Currency Formatter | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may configure a custom formatting of currencies. The reason for | ||
| this is to help further internationalize the formatting past the basic | ||
| format column in the table. When set to `null` the package will use the | ||
| format from storage. | ||
| | ||
| | ||
*/ | ||
|
||
'formatter' => null, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Currency Formatter Specific Configuration | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may configure as many currency formatters as you wish. | ||
| | ||
*/ | ||
|
||
'formatters' => [ | ||
|
||
'php_intl' => [ | ||
'class' => \ForexAPI\Currency\Formatters\PHPIntl::class, | ||
], | ||
|
||
], | ||
]; |
50 changes: 50 additions & 0 deletions
50
database/migrations/2013_11_26_161501_create_currency_table.php
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,50 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateCurrencyTable extends Migration | ||
{ | ||
/** | ||
* Currencies table name | ||
* | ||
* @var string | ||
*/ | ||
protected $table_name; | ||
|
||
/** | ||
* Create a new migration instance. | ||
*/ | ||
public function __construct() | ||
{ | ||
$this->table_name = config('currency.drivers.database.table'); | ||
} | ||
|
||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create($this->table_name, function ($table) { | ||
$table->increments('id')->unsigned(); | ||
$table->string('name'); | ||
$table->string('code', 10)->index(); | ||
$table->string('symbol', 25); | ||
$table->string('format', 50); | ||
$table->string('exchange_rate'); | ||
$table->boolean('active')->default(false); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::drop($this->table_name); | ||
} | ||
} |
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,26 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="PSR2-package"> | ||
<description>The PSR2 standard</description> | ||
|
||
<!-- use preg_match https://github.com/squizlabs/PHP_CodeSniffer/issues/742#issuecomment-215250517 --> | ||
<exclude-pattern>/resources/</exclude-pattern> | ||
<exclude-pattern>/vendor/</exclude-pattern> | ||
<exclude-pattern>/_[a-zA-Z0-9\._]+\.php</exclude-pattern> | ||
<exclude-pattern>/\.[a-zA-Z0-9\._]+\.php</exclude-pattern> | ||
<exclude-pattern>\.git</exclude-pattern> | ||
|
||
<!-- Include the whole PSR2 standard --> | ||
<rule ref="PSR2"> | ||
<exclude name="PSR1.Methods.CamelCapsMethodName"/> | ||
<exclude name="PSR2.Files.EndFileNewline"/> | ||
<exclude name="PSR2.Methods.FunctionCallSignature.MultipleArguments"/> | ||
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace"/> | ||
</rule> | ||
|
||
<!-- Lines can be longer --> | ||
<rule ref="Generic.Files.LineLength"> | ||
<properties> | ||
<property name="lineLimit" value="9999"/> | ||
</properties> | ||
</rule> | ||
</ruleset> |
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,10 @@ | ||
parameters: | ||
excludes_analyse: | ||
- vendor | ||
- resources | ||
ignoreErrors: | ||
- '#Function app not found#' | ||
- '#Function config_path not found#' | ||
- '#Function base_path not found#' | ||
- '#Function config not found#' | ||
- '#Parameter \$request of method#' |
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 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
syntaxCheck="false" | ||
> | ||
<testsuites> | ||
<testsuite name="Package Test Suite"> | ||
<directory suffix=".php">./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
Oops, something went wrong.