Skip to content

Commit c089540

Browse files
committed
WIP
0 parents  commit c089540

33 files changed

+935
-0
lines changed

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

.gitattributes

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and documentation with "export-ignore".
5+
/.gitattributes export-ignore
6+
/.gitignore export-ignore
7+
/.travis.yml export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/.scrutinizer.yml export-ignore
10+
/tests export-ignore
11+
/.editorconfig export-ignore

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.idea
2+
build
3+
composer.lock
4+
docs
5+
vendor
6+
coverage
7+
phpunit.xml

.php_cs.cache

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"php":"7.3.9","version":"2.15.3","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_constants":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true},"hashes":{"config\/config.php":2102360284,"\/private\/var\/folders\/cx\/7psflyln1ml2ryj9ydn4nmcc0000gn\/T\/phpcsfixer_temp.tmp\/src\/Service\/Contracts\/CurrencylayerContract.php":1812061037,"\/private\/var\/folders\/cx\/7psflyln1ml2ryj9ydn4nmcc0000gn\/T\/phpcsfixer_temp.tmp\/src\/LaravelCurrencylayerFacade.php":145204974,"\/private\/var\/folders\/cx\/7psflyln1ml2ryj9ydn4nmcc0000gn\/T\/phpcsfixer_temp.tmp\/src\/Service\/Currencylayer.php":3509582033,"\/private\/var\/folders\/cx\/7psflyln1ml2ryj9ydn4nmcc0000gn\/T\/phpcsfixer_temp.tmp\/src\/LaravelCurrencylayer.php":4235467693,"\/private\/var\/folders\/cx\/7psflyln1ml2ryj9ydn4nmcc0000gn\/T\/phpcsfixer_temp.tmp\/config\/config.php":4176167077,"\/private\/var\/folders\/cx\/7psflyln1ml2ryj9ydn4nmcc0000gn\/T\/phpcsfixer_temp.tmp\/src\/LaravelCurrencylayerServiceProvider.php":1873832319,"\/private\/var\/folders\/cx\/7psflyln1ml2ryj9ydn4nmcc0000gn\/T\/phpcsfixer_temp.tmp\/tests\/ExampleTest.php":3152967021,"\/private\/var\/folders\/cx\/7psflyln1ml2ryj9ydn4nmcc0000gn\/T\/phpcsfixer_temp.tmp\/src\/CurrencylayerFacade.php":3236491145,"\/private\/var\/folders\/cx\/7psflyln1ml2ryj9ydn4nmcc0000gn\/T\/phpcsfixer_temp.tmp\/database\/factories\/UserFactory.php":25503107,"\/private\/var\/folders\/cx\/7psflyln1ml2ryj9ydn4nmcc0000gn\/T\/phpcsfixer_temp.tmp\/tests\/Models\/Currency.php":1988590161,"\/private\/var\/folders\/cx\/7psflyln1ml2ryj9ydn4nmcc0000gn\/T\/phpcsfixer_temp.tmp\/src\/Models\/Currency.php":4069398191,"\/private\/var\/folders\/cx\/7psflyln1ml2ryj9ydn4nmcc0000gn\/T\/phpcsfixer_temp.tmp\/tests\/FakeClient.php":781335320,"src\/Currencylayer.php":171422074,"\/private\/var\/folders\/cx\/7psflyln1ml2ryj9ydn4nmcc0000gn\/T\/phpcsfixer_temp.tmp\/tests\/Models\/RateTest.php":2889865167,"\/private\/var\/folders\/cx\/7psflyln1ml2ryj9ydn4nmcc0000gn\/T\/phpcsfixer_temp.tmp\/database\/factories\/RateFactory.php":1888403302,"\/private\/var\/folders\/cx\/7psflyln1ml2ryj9ydn4nmcc0000gn\/T\/phpcsfixer_temp.tmp\/src\/Currencylayer.php":1931807484,"\/private\/var\/folders\/cx\/7psflyln1ml2ryj9ydn4nmcc0000gn\/T\/phpcsfixer_temp.tmp\/src\/Models\/Rate.php":2565230854,"\/private\/var\/folders\/cx\/7psflyln1ml2ryj9ydn4nmcc0000gn\/T\/phpcsfixer_temp.tmp\/tests\/CurrencylayerTest.php":3487159117}}

.phpunit.result.cache

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
C:37:"PHPUnit\Runner\DefaultTestResultCache":1662:{a:2:{s:7:"defects";a:9:{s:68:"Orkhanahmadov\LaravelCurrencylayer\Tests\ExampleTest::testTrueIsTrue";i:4;s:64:"Orkhanahmadov\LaravelCurrencylayer\Tests\CurrencylayerTest::test";i:4;s:74:"Orkhanahmadov\LaravelCurrencylayer\Tests\CurrencylayerTest::testCurrencies";i:4;s:74:"Orkhanahmadov\LaravelCurrencylayer\Tests\CurrencylayerTest::testFetchRates";i:3;s:84:"Orkhanahmadov\LaravelCurrencylayer\Tests\Models\CurrencyTest::testHasManyTargetRates";i:4;s:78:"Orkhanahmadov\LaravelCurrencylayer\Tests\CurrencylayerTest::testFetchLiveRates";i:3;s:80:"Orkhanahmadov\LaravelCurrencylayer\Tests\Models\RateTest::testHasManyTargetRates";i:3;s:77:"Orkhanahmadov\LaravelCurrencylayer\Tests\Models\RateTest::testBelongsToTarget";i:3;s:84:"Orkhanahmadov\LaravelCurrencylayer\Tests\CurrencylayerTest::testFetchHistoricalRates";i:3;}s:5:"times";a:9:{s:68:"Orkhanahmadov\LaravelCurrencylayer\Tests\ExampleTest::testTrueIsTrue";d:0.302;s:64:"Orkhanahmadov\LaravelCurrencylayer\Tests\CurrencylayerTest::test";d:0.351;s:74:"Orkhanahmadov\LaravelCurrencylayer\Tests\CurrencylayerTest::testCurrencies";d:0.535;s:74:"Orkhanahmadov\LaravelCurrencylayer\Tests\CurrencylayerTest::testFetchRates";d:0.736;s:84:"Orkhanahmadov\LaravelCurrencylayer\Tests\Models\CurrencyTest::testHasManyTargetRates";d:0.619;s:78:"Orkhanahmadov\LaravelCurrencylayer\Tests\CurrencylayerTest::testFetchLiveRates";d:0.713;s:80:"Orkhanahmadov\LaravelCurrencylayer\Tests\Models\RateTest::testHasManyTargetRates";d:0.724;s:77:"Orkhanahmadov\LaravelCurrencylayer\Tests\Models\RateTest::testBelongsToTarget";d:0.544;s:84:"Orkhanahmadov\LaravelCurrencylayer\Tests\CurrencylayerTest::testFetchHistoricalRates";d:0.755;}}}

.scrutinizer.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
filter:
2+
excluded_paths: [tests/*]
3+
4+
checks:
5+
php:
6+
remove_extra_empty_lines: true
7+
remove_php_closing_tag: true
8+
remove_trailing_whitespace: true
9+
fix_use_statements:
10+
remove_unused: true
11+
preserve_multiple: false
12+
preserve_blanklines: true
13+
order_alphabetically: true
14+
fix_php_opening_tag: true
15+
fix_linefeed: true
16+
fix_line_ending: true
17+
fix_identation_4spaces: true
18+
fix_doc_comments: true
19+

.styleci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
preset: laravel
2+
3+
disabled:
4+
- single_class_element_per_statement

.travis.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
language: php
2+
3+
php:
4+
- 7.1
5+
- 7.2
6+
- 7.3
7+
- 7.4snapshot
8+
9+
env:
10+
matrix:
11+
- LARAVEL=5.5.* TESTBENCH=3.5.* PHPUNIT=6.* COMPOSER_FLAGS=""
12+
- LARAVEL=5.5.* TESTBENCH=3.5.* PHPUNIT=6.* COMPOSER_FLAGS="--prefer-lowest"
13+
- LARAVEL=5.8.* TESTBENCH=3.8.* PHPUNIT=7.* COMPOSER_FLAGS=""
14+
- LARAVEL=5.8.* TESTBENCH=3.8.* PHPUNIT=7.* COMPOSER_FLAGS="--prefer-lowest"
15+
- LARAVEL=6.* TESTBENCH=4.* PHPUNIT=8.* COMPOSER_FLAGS=""
16+
- LARAVEL=6.* TESTBENCH=4.* PHPUNIT=8.* COMPOSER_FLAGS="--prefer-lowest"
17+
18+
matrix:
19+
fast_finish: true
20+
exclude:
21+
- php: 7.1
22+
env: LARAVEL=6.* TESTBENCH=4.* PHPUNIT=8.*
23+
allow_failures:
24+
- php: 7.4snapshot
25+
26+
cache:
27+
directories:
28+
- $HOME/.composer/cache
29+
30+
before_script:
31+
- travis_retry composer self-update
32+
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source
33+
34+
script:
35+
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
36+
37+
after_script:
38+
- php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
All notable changes to `laravel-currencylayer` will be documented in this file
4+
5+
## 1.0.0 - 2019-09-11
6+
7+
- Initial release

CONTRIBUTING.md

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Contributing
2+
3+
Contributions are **welcome** and will be fully **credited**.
4+
5+
Please read and understand the contribution guide before creating an issue or pull request.
6+
7+
## Etiquette
8+
9+
This project is open source, and as such, the maintainers give their free time to build and maintain the source code
10+
held within. They make the code freely available in the hope that it will be of use to other developers. It would be
11+
extremely unfair for them to suffer abuse or anger for their hard work.
12+
13+
Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the
14+
world that developers are civilized and selfless people.
15+
16+
It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
17+
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used.
18+
19+
## Viability
20+
21+
When requesting or submitting new features, first consider whether it might be useful to others. Open
22+
source projects are used by many developers, who may have entirely different needs to your own. Think about
23+
whether or not your feature is likely to be used by other users of the project.
24+
25+
## Procedure
26+
27+
Before filing an issue:
28+
29+
- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
30+
- Check to make sure your feature suggestion isn't already present within the project.
31+
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
32+
- Check the pull requests tab to ensure that the feature isn't already in progress.
33+
34+
Before submitting a pull request:
35+
36+
- Check the codebase to ensure that your feature doesn't already exist.
37+
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.
38+
39+
## Requirements
40+
41+
If the project maintainer has any additional requirements, you will find them listed here.
42+
43+
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer).
44+
45+
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
46+
47+
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
48+
49+
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.
50+
51+
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
52+
53+
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
54+
55+
**Happy coding**!

LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) Orkhan Ahmadov
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# WIP
2+
3+
## Installation
4+
5+
You can install the package via composer:
6+
7+
```bash
8+
composer require orkhanahmadov/laravel-currencylayer
9+
```
10+
11+
## Usage
12+
13+
``` php
14+
// Usage description here
15+
```
16+
17+
### Testing
18+
19+
``` bash
20+
composer test
21+
```
22+
23+
### Changelog
24+
25+
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
26+
27+
## Contributing
28+
29+
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
30+
31+
### Security
32+
33+
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
34+
35+
## Credits
36+
37+
- [Orkhan Ahmadov](https://github.com/orkhanahmadov)
38+
- [All Contributors](../../contributors)
39+
40+
## License
41+
42+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

composer.json

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"name": "orkhanahmadov/laravel-currencylayer",
3+
"description": "Laravel package for CurrencyLayer",
4+
"keywords": [
5+
"orkhanahmadov",
6+
"laravel",
7+
"currency",
8+
"currencylayer",
9+
"laravel-currencylayer"
10+
],
11+
"homepage": "https://github.com/orkhanahmadov/laravel-currencylayer",
12+
"license": "MIT",
13+
"type": "library",
14+
"authors": [
15+
{
16+
"name": "Orkhan Ahmadov",
17+
"email": "[email protected]",
18+
"role": "Developer"
19+
}
20+
],
21+
"require": {
22+
"php": "^7.1",
23+
"ext-json": "*",
24+
"illuminate/container": "5.5.*|5.8.*|^6.0",
25+
"illuminate/contracts": "5.5.*|5.8.*|^6.0",
26+
"illuminate/database": "5.5.*|5.8.*|^6.0",
27+
"illuminate/support": "5.5.*|5.8.*|^6.0",
28+
"oceanapplications/currencylayer-php-client": "^1.4"
29+
},
30+
"require-dev": {
31+
"orchestra/testbench": "3.5.*|3.8.*|^4.0",
32+
"phpunit/phpunit": "^6.0|^7.0|^8.0"
33+
},
34+
"autoload": {
35+
"psr-4": {
36+
"Orkhanahmadov\\LaravelCurrencylayer\\": "src"
37+
}
38+
},
39+
"autoload-dev": {
40+
"psr-4": {
41+
"Orkhanahmadov\\LaravelCurrencylayer\\Tests\\": "tests"
42+
}
43+
},
44+
"scripts": {
45+
"test": "vendor/bin/phpunit",
46+
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
47+
},
48+
"extra": {
49+
"laravel": {
50+
"providers": [
51+
"Orkhanahmadov\\LaravelCurrencylayer\\LaravelCurrencylayerServiceProvider"
52+
],
53+
"aliases": {
54+
"LaravelCurrencylayer": "Orkhanahmadov\\LaravelCurrencylayer\\LaravelCurrencylayerFacade"
55+
}
56+
}
57+
},
58+
"config": {
59+
"sort-packages": true
60+
},
61+
"minimum-stability": "dev",
62+
"prefer-stable": true
63+
}

config/config.php

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
return [
4+
'access_key' => env('CURRENCYLAYER_ACCESS_KEY'),
5+
];
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
use Faker\Generator as Faker;
4+
use Orkhanahmadov\LaravelCurrencylayer\Models\Currency;
5+
6+
/**
7+
* @var \Illuminate\Database\Eloquent\Factory $factory
8+
*/
9+
$factory->define(Currency::class, function (Faker $faker) {
10+
return [
11+
'code' => $faker->unique()->randomLetter,
12+
'name' => $faker->sentence,
13+
];
14+
});

database/factories/RateFactory.php

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
use Carbon\Carbon;
4+
use Faker\Generator as Faker;
5+
use Orkhanahmadov\LaravelCurrencylayer\Models\Currency;
6+
use Orkhanahmadov\LaravelCurrencylayer\Models\Rate;
7+
8+
/**
9+
* @var \Illuminate\Database\Eloquent\Factory $factory
10+
*/
11+
$factory->define(Rate::class, function (Faker $faker) {
12+
return [
13+
'source_currency_id' => function () {
14+
return factory(Currency::class)->create();
15+
},
16+
'target_currency_id' => function () {
17+
return factory(Currency::class)->create();
18+
},
19+
'rate' => $faker->randomFloat(12, 1, 10),
20+
'rate_for' => Carbon::now()->unix(),
21+
];
22+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
6+
7+
class CreateCurrencylayerCurrenciesTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up()
13+
{
14+
Schema::create('currencylayer_currencies', function (Blueprint $table) {
15+
$table->bigIncrements('id');
16+
$table->string('name');
17+
$table->string('code', 3)->unique();
18+
});
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*/
24+
public function down()
25+
{
26+
Schema::dropIfExists('currencylayer_currencies');
27+
}
28+
}

0 commit comments

Comments
 (0)