crypto-technology / laravel-cryptocurrency by BoGnY

Laravel provider to have all cryptocurrency infos in a single package without using a database.
12
2
3
Package Data
Maintainer Username: BoGnY
Maintainer Contact: admin@cryptotech.srl (Crypto Technology srl)
Package Create Date: 2019-03-22
Package Last Update: 2019-12-11
Language: PHP
License: GPL-3.0
Last Refreshed: 2024-11-19 03:18:02
Package Statistics
Total Downloads: 12
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 2
Total Watchers: 3
Total Forks: 2
Total Open Issues: 1

Laravel Cryptocurrency package

Latest Version on Packagist Total Downloads Build Status Last commit License Requires PHP7.1

Laravel provider to have all cryptocurrency infos in a single package without using a database.

Installation

$ composer require crypto-technology/laravel-cryptocurrency

Laravel 5.5+

If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php:

'providers' => [
    ...
    CryptoTech\Laravel\CryptocurrencyServiceProvider::class,
    ...
],

If you want to use the facade, add the Facade to the facades array in config/app.php:

'aliases' => [
    ...
    'Cryptocurrency' => CryptoTech\Laravel\Facades\Cryptocurrency::class,
    ...
]

Copy the package config to your local config with the publish command:

$ php artisan vendor:publish --provider="CryptoTech\Laravel\CryptocurrencyServiceProvider"

Lumen

Configure the Service Provider and alias:

# boostrap/app.php

// Register the facade
$app->withFacades(true, [
    CryptoTech\Laravel\Facades\Cryptocurrency::class => 'Cryptocurrency'
]);

// Load the configuration
$app->configure('cryptocurrency');

// Register the service provider
$app->register(CryptoTech\Laravel\CryptocurrencyServiceProvider::class);

Copy the configuration file to /config/cryptocurrency.php if you wish to override it.

Usage

First, make sure that interested cryptocurrency is enabled in your /config/cryptocurrency.php config file.
All methods available on \CryptoTech\Cryptocurrency\Cryptocurrency class can be used in this package.

# HomeController.php

use Cryptocurrency;

// Get the Bitcoin object
$bitcoin = Cryptocurrency::get('Bitcoin');

// Return (string) cryptocurrency name
$bitcoin->getName();

// Return (string) cryptocurrency description
$bitcoin->getDescription();

// Return (boolean) cryptocurrency mineable state
$bitcoin->isMineable();

return view('home', compact('bitcoin'));
# home.blade.php

@section('content')
    <p>{!! $bitcoin->getSymbol() !!}</p>
@endsection

More information can be found in the \CryptoTech\Cryptocurrency\CryptocurrencyInterface interface PhpDocumentation.
The \CryptoTech\Cryptocurrency\Cryptocurrency class contains, in addition to the get methods, also set methods (only for description and for project, explorer and sourcecode urls), which allow you to momentarily overwrite the default values.

Changelog

Please see the CHANGELOG for more information on what has changed recently.

Testing

# For Windows system
$ composer test-win

# For Unix system
$ composer test-unix

Contributing

Your help is always welcome! Feel free to open issues, ask questions, talk about it and discuss this tool.
Of course there are some contributing guidelines and a code of conduct, which I invite you to check out.
For all other contributions, see below.

After every code changes, but before submit your pull request, please apply Php Cs Fixer code fixing:

# For Windows system
$ composer php-cs-fixer-win

# For Unix system
$ composer php-cs-fixer-unix

Security

The CryptoTech\Laravel package will be checked for security vulnerabilities using Roave Security Advisories checker. If you discover any security related issues, please email security@cryptotech.srl instead of using the issue tracker.

Code

cloc|github.com/AlDanial/cloc v 1.80 T=0.50 s (28.0 files/s, 1564.0 lines/s) --- | ---

Language|files|blank %|comment %|code|scale|3rd|gen.|equiv :-------|-------:|-------:|-------:|-------:|-------:|-------:|-------:|-------: Markdown|3|28.08|0.00|146|1|146 PHP|6|11.57|53.71|117|3.5|409.5 JSON|1|0.00|0.00|97|2.5|242.5 YAML|3|12.20|2.44|70|0.9|63 XML|1|7.94|26.98|41|1.9|77.9 --------|--------|--------|--------|--------|--------|--------|--------|-------- SUM:|14|14.19|25.58|471|x|1.99|=|938.90

Credits

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

The GNU General Public License version 3. Please see the license file for more information. This work is licensed under the GNU GPL v3.