Git Product home page Git Product logo

flashed's Introduction

Flashed

Latest Version on Packagist License Total Downloads

Flashed is a tiny solution to deal with the flash session in Laravel. Its aim is to keeping simple and driver based messages styling in your views, controllers, repositories, etc.

Getting started

First of all, you have to install the package through Composer running the following command in your terminal:

composer require gocanto/flashed

Once composer is done, add the package service provider in the providers array in config/app.php:

Gocanto\Flashed\FlashedServiceProvider::class,

Second of all, you will have to publish the vendor files shipped within this package. As so,

php artisan vendor:publish --tag=flashed

Third of all, you will have to specify the configuration option you wish to have for working with this package. So far, the package was made to work with Twitter bootstrap, but you can modify this to work with any CSS styling you might need.

After running this command, you will be able to see the partial view shipped with the packages, and the configuration file. Being the second one the most important file in order for the Flashed library to work properly.

You will find a good explanation about what each of the configuration options are about. You can take a look at them clicking on here.

How it to implement it in your controllers

You have to import he flash class, as so:

use Gocanto\Flashed\Flash;

Then, you can use its static method to create a new flash message, as so:

Flash::make()->message([
  'title' => 'Hi There!',
  'body' => 'this is the body'
]);

The title and body are optional, so you do not have to pass both to the make method. If you do not pass a title, the default one will be used instead.

Also, you will have the ability to create five different flash messages, for examples: 'primary', 'success', 'warning', 'danger' and 'info'. You only need to invoke them like so:

Flash::make('info')->message([
  'title' => 'This is a info message!',
  'body' => 'this is the body'
]);

Note: By default, the message type is danger

The view shipped out

The views included with this package can be imported like so,

@include ('vendor.flashedit.bootstrap')

And it was created to work with the default driver which is twitter bootstrap

Contributing

Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.

License

The MIT License (MIT). Please see License File for more information.

Don't forget to follow me on twitter!

Thanks!

Gustavo Ocanto. [email protected]

flashed's People

Contributors

gocanto avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.