GithubHelp home page GithubHelp logo

jeffersonsimaogoncalves / sweetalert Goto Github PK

View Code? Open in Web Editor NEW

This project forked from waveygroup/sweetalert

1.0 0.0 0.0 12 KB

๐Ÿฉ SweetAlert 2 Implementation for Laravel

Home Page: https://wavey.group

PHP 98.81% Blade 1.19%

sweetalert's Introduction


Sweetalert Logo

๐ŸŸฃ SweetAlert2 Support for Laravel

Add beautiful alerts by SweetAlert directly into your Laravel application, with a simple setup, and handly helpers.
View Demo ยท Report Bug ยท Request Feature

Contributors Forks Stargazers Issues MIT License LinkedIn Twitter

About Sweetalert

Sweetalert is a package for Laravel that allows you to directly interact with SweetAlert. Initially created by uxweb, but now maintained and added support for the latest release of SweetAlert.

We will be releasing some custom alerts within this package in the future, and will continue to maintain the package for future releases of SweetAlert2.

(back to top)

Getting Started

wavey/sweetalert is really simple to set up, If you are familiar with Composer & Laravel, you will most likely know what to do already, however, follow the guide below to get the alerts working and help you make your application look stunning.

Installation

Firstly, require the package into your application through composer using the following command:

composer require wavey/sweetalert

Once you have completed this, run the installer:

php artisan sweetalert:install

This will publish the sweetalert.blade.php file into resources/views/vendor/wavey/sweetalert.

You will now need to require the SweetAlert2 package. The simplest way to achieve this is to include the CDN link, simply add the following link into your layouts.

<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>

Once you have done this, you will need to include the blade file into your layouts, Inside your layout, add:

@include('sweetalert::sweetalert')

Now, you are good to go! Check out the uage section to learn how to show alerts from your controllers.

Through NPM

if you don't want to use the CDN link, you can also include the SweetAlert2 library through NPM.

Install from command line:

If you want to install from your command line, run the following command:

npm install sweetalert2

Then you need to include the library into your javascript, do the following:

// ES6 Modules or TypeScript
import Swal from 'sweetalert2'

// CommonJS
const Swal = require('sweetalert2')

Now compile your assets and include your main javascript file into your views, and you are good to go!

Install from install command (WIP):

You can also install the NPM package through our install command. When installing the package, run the following command instead:

php artisan sweetalert:install --npm

This command will install the NPM package and include inside resources/js/app.js and then run npm run dev to compile your assets.

(back to top)

Usage

We have made Sweetalert very simple to use, firstly, include the library at the top of your controller:

use Wavey\Sweetalert\Sweetalert;

Then, simply call the method you want, below is the methods we support currently:

Sweetalert::basic('Description', 'Title');
Sweetalert::info('Description', 'Title');
Sweetalert::success('Description', 'Title');
Sweetalert::error('Description', 'Title');
Sweetalert::warning('Description', 'Title');
Sweetalert::message('Description', 'Title');
Sweetalert::message('Description <h2>Custom HTML</h2>', 'Title')->html();

We will be releasing support for Toast notifications too, along with some custom alert helpers in the coming releases.

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Your Name - @waveygroup - [email protected]

Project Link: https://github.com/waveygroup/sweetalert

(back to top)

Acknowledgments

(back to top)

sweetalert's People

Stargazers

 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.