davide-casiraghi/php-responsive-random-quote

A package that shows responsive random quotes

2.0.2 2019-06-27 06:59 UTC

This package is auto-updated.

Last update: 2024-04-08 20:20:27 UTC


README

Latest Stable Version StyleCI Build Status Quality Score Coverage Status 68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f34656466373435663262363466376630613533632f6d61696e7461696e6162696c697479 GitHub last commit

Laravel Reponsive Random Quotes

Show a random quote or the quote of the day in your PHP Laravel project.
The package support multi language trough dimsav/laravel-translatable and mcamara/laravel-localization packages.

Installation

Require the package using composer:

composer require davide-casiraghi/php-responsive-random-quote

Publish the files from the service provider

php artisan vendor:publish --force

And then pick the number of the related service provider.

Create the DB tables

php artisan migrate

This will create in your databases two new tables: quotes and quote_translations.

Import the _responsive-quote.scss file in /resources/scss/app.scss

@import 'vendor/responsive-quotes/responsive-quote';   

and then run in console: npm run dev

Usage

Add quotes to the database table

The package adds in the application in which it is installed the route /php-responsive-quote/
From this route it's possible to add, edit and remove the quotes and their translations.

Show a random quote

use DavideCasiraghi\PhpResponsiveRandomQuote\QuoteFactory;

$quote = PhpResponsiveQuote::getRandomQuote();

Then in any blade file is possible include the view like this:

@include('vendor.responsive-quotes.show-random-quote', [
   'quoteAuthor' => $quote['author'],
   'quoteText' => $quote['text'],
])

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Testing

You can run unit tests checking the code coverage using this command.

./vendor/bin/phpunit --coverage-html=html

So you can find the reports about the code coverage in this file /html/index.html

License

MIT