Download the PHP package rft/yii2-alert-modal-widget without Composer

On this page you can find all versions of the php package rft/yii2-alert-modal-widget. 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 yii2-alert-modal-widget

Yii2 Alert Modal Widget

A standalone, reusable confirmation modal widget for the Yii2 Framework with SweetAlert-like UI/UX. This widget is completely independent of Bootstrap and includes its own CSS and JavaScript.

Features

Installation

This is an internal widget for your Yii2 application. To use it:

  1. Copy the AlertModalWidget.php file to your frontend/components/widgets/ directory
  2. Ensure Font Awesome is included in your project (for icons)

No Bootstrap required! The widget includes all necessary CSS and JavaScript.

Basic Usage

Step 1: Define Your Modals

Place modal widgets in your view or layout file. Note the button class format:

Step 2: Create Trigger Buttons

Create buttons/links with the corresponding CSS class. Use standard Bootstrap classes for your buttons, but add the modal trigger class:

Complete Working Example

Here's exactly how you should implement it:

Your Specific Use Case Example

Based on your code, here's exactly how to implement it:

Configuration Options

Widget Properties

Property Type Default Description
triggerSelector string required CSS selector for trigger elements
title string 'Confirmation' Default modal title
body string 'Are you sure you want to proceed?' Default modal body text
iconType string 'question' Icon type: 'question', 'warning', 'success', 'error', 'info'
iconColor string '#87adbd' Custom icon color (hex)
confirmButtonLabel string 'Confirm' Confirmation button label
confirmButtonClass string 'alert-modal-btn-confirm' Must start with 'alert-modal-btn-confirm'
cancelButtonLabel string 'Cancel' Cancel button label
cancelButtonClass string 'alert-modal-btn-cancel' CSS classes for cancel button
modalSize string 'modal-md' Modal size: 'modal-sm', 'modal-md', 'modal-lg', 'modal-xl'
modalOptions array [] Additional modal options

Button Classes Format

Important: The confirmButtonClass must follow this format:

Available color classes (add after the base class):

Data Attributes for Dynamic Overrides

Use these attributes on your trigger buttons/links:

Attribute Example Description
data-alert-modal-title data-alert-modal-title="Custom Title" Override modal title
data-alert-modal-body data-alert-modal-body="Custom message" Override modal body text
data-alert-modal-confirm-label data-alert-modal-confirm-label="Yes, Proceed" Override confirm button label
data-alert-modal-confirm-class data-alert-modal-confirm-class="btn-warning" Add CSS classes to confirm button
data-alert-modal-icon data-alert-modal-icon="warning" Override icon type
data-alert-modal-icon-color data-alert-modal-icon-color="#ff0000" Override icon color
data-method data-method="post" HTTP method for the action
data-params data-params='{"key":"value"}' Additional POST parameters
data-title (legacy) data-title="Legacy Title" Legacy title override (backward compatible)
data-confirm (legacy) data-confirm="Legacy message" Legacy body override (backward compatible)
data-confirm-label (legacy) data-confirm-label="Legacy Label" Legacy label override (backward compatible)

Important Notes for Your Implementation

  1. Button Class Format is CRITICAL:

  2. Trigger Buttons Use Regular Bootstrap Classes:

  3. Font Awesome Required: The widget uses Font Awesome for icons:

  4. CSRF Protection: For POST requests, ensure CSRF meta tags are in your layout:

  5. Multiple Widgets Work Fine: The latest version has fixed the JavaScript class conflict issue.

Troubleshooting Common Issues

Modal Doesn't Show

Styling Issues

POST Requests Not Working

The README is now updated to accurately reflect your current standalone widget implementation.


All versions of yii2-alert-modal-widget with dependencies

PHP Build Version
Package Version
Requires yiisoft/yii2 Version ~2.0.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 rft/yii2-alert-modal-widget contains the following files

Loading the files please wait ...