Download the PHP package dizatech/sweet-alert without Composer

On this page you can find all versions of the php package dizatech/sweet-alert. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sweet-alert

Easy Sweet Alert Messages for Laravel

Latest Version StyleCI Total Downloads

Installation

Require the package using Composer.

If using laravel < 5.5 include the service provider and alias within config/app.php.

Installing Frontend Dependency

This package works only by using the BEAUTIFUL REPLACEMENT FOR JAVASCRIPT'S "ALERT".

Using a CDN

Using Laravel Mix

Install using Yarn

Install using NPM

Require sweetalert within your resources/js/bootstrap.js file.

Then make sure to include your scripts in your blade layout. Remove the defer attribute if your script tag contains it, defer will delay the execution of the script which will cause an error as the sweet::alert blade template is rendered first by the browser as html.

Finally compile your assets with Mix

Usage

Using the Facade

First import the SweetAlert facade in your controller.

Within your controllers, before you perform a redirect...

Here are some examples on how you can use the facade:

Using the helper function

alert($message = null, $title = '')

In addition to the previous listed methods you can also just use the helper function without specifying any message type. Doing so is similar to:

alert()->message('Message', 'Optional Title')

Like with the Facade we can use the helper with the same methods:

Within your controllers, before you perform a redirect...

For a general information alert, just do: alert('Some message'); (same as alert()->message('Some message');).

Using the Middleware

Middleware Groups

First register the middleware in web middleware groups by simply adding the middleware class UxWeb\SweetAlert\ConvertMessagesIntoSweetAlert::class into the \$middlewareGroups of your app/Http/Kernel.php class:

Make sure you register the middleware within the 'web' group only.

Route Middleware

Or if you would like to assign the middleware to specific routes only, you should add the middleware to $routeMiddleware in app/Http/Kernel.php file:

Next step: within your controllers, set your return message (using with()) and send the proper message and proper type.

or

NOTE: When using the middleware it will make an alert to display if it detects any of the following keys flashed into the session: error, success, warning, info, message, basic.

Final Considerations

By default, all alerts will dismiss after a sensible default number of seconds.

But not to worry, if you need to specify a different time you can:

Also, if you need the alert to be persistent on the page until the user dismiss it by pressing the alert confirmation button:

You can render html in your message with the html() method like this:

Customize

Config

If you need to customize the default configuration options for this package just export the configuration file:

A sweet-alert.php configuration file will be published to your config directory. By now, the only configuration that can be changed is the timer for all autoclose alerts.

View

If you need to customize the included alert message view, run:

The package view is located in the resources/views/vendor/sweet/ directory.

You can customize this view to fit your needs.

Configuration Options

You have access to the following configuration options to build a custom view:

Please check the CONFIGURATION section in the website for all other options available.

Default View

The sweet_alert.alert session key contains a JSON configuration object to pass it directly to Sweet Alert.

Note that {!! !!} are used to output the json configuration object unescaped, it will not work with {{ }} escaped output tags.

Custom View

This is an example of how you can customize your view to fit your needs:

Note that you must use "" (double quotes) to wrap the values except for the timer option.

Tests

To run the included test suite:

Demo

License

Sweet Alert for Laravel is open-sourced software licensed under the MIT license.


All versions of sweet-alert with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.1|^9.0
illuminate/support Version ~5.0|^6.0|^7.0|^8.0|^9.0|^10.0
illuminate/session Version ~5.0|^6.0|^7.0|^8.0|^9.0|^10.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dizatech/sweet-alert contains the following files

Loading the files please wait ....