PHPackages                             varunsridharan/sweetalert2-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. varunsridharan/sweetalert2-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

varunsridharan/sweetalert2-php
==============================

This Custom PHP Lib depends on SweetAlert2 JS Lib and this php class works as Javascript code builder.

1.0.6(5y ago)41.4k11MITPHP

Since Apr 15Pushed 5y ago2 watchersCompare

[ Source](https://github.com/varunsridharan/sweetalert2-php)[ Packagist](https://packagist.org/packages/varunsridharan/sweetalert2-php)[ Docs](https://github.com/varunsridharan/sweetalert2-php/)[ Fund](https://paypal.me/varunsridharan23)[ Fund](https://www.buymeacoffee.com/varunsridharan)[ RSS](/packages/varunsridharan-sweetalert2-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)DependenciesVersions (8)Used By (1)

 [ ![SweetAlert2](https://raw.githubusercontent.com/sweetalert2/sweetalert2/master/assets/swal2-logo.png) ](https://sweetalert2.github.io/)

 A beautiful, responsive, customizable, accessible (WAI-ARIA) replacement for JavaScript's popup boxes. Zero dependencies.

 [ ![](https://camo.githubusercontent.com/4fbce3df17d5b3f11c6087f9554390bb4a174689bea9302c46dc6e3b9f3efc52/68747470733a2f2f7261772e6769746875622e636f6d2f7377656574616c657274322f7377656574616c657274322f6d61737465722f6173736574732f7377656574616c657274322e676966)
 See SweetAlert2 in action ↗ ](https://sweetalert2.github.io/)

[![Latest Stable Version](https://camo.githubusercontent.com/325ac430ae74072396efc6f3d3c6bf9c58abd057c649bac064776575411fed8c/68747470733a2f2f706f7365722e707567782e6f72672f766172756e73726964686172616e2f7377656574616c657274322d7068702f76657273696f6e)](https://packagist.org/packages/varunsridharan/sweetalert2-php)[![Latest Unstable Version](https://camo.githubusercontent.com/97a1eb0dd61dadcaf0a3fcf91be493e03cc8a17e19ab7dc640c08bf933f59c1a/68747470733a2f2f706f7365722e707567782e6f72672f766172756e73726964686172616e2f7377656574616c657274322d7068702f762f756e737461626c65)](https://packagist.org/packages/varunsridharan/sweetalert2-php)[![Total Downloads](https://camo.githubusercontent.com/4e3defc7366e3ed8016cc6c963a5476bdbd5509b627b2d0b89bd00e8d96d0da7/68747470733a2f2f706f7365722e707567782e6f72672f766172756e73726964686172616e2f7377656574616c657274322d7068702f646f776e6c6f616473)](https://packagist.org/packages/varunsridharan/sweetalert2-php)[![WP](https://camo.githubusercontent.com/ffba221a69a414072e7c2cb0bc46e849eddee342fbc151dd967cea940155c2b8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f576f726450726573732d5374616e6461722d3161626339632e737667)](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/)[![License](https://camo.githubusercontent.com/fa531739ae95f07151803b28f1e0d394da0647c0ba091171bd31a77f38b6f186/68747470733a2f2f706f7365722e707567782e6f72672f766172756e73726964686172616e2f7377656574616c657274322d7068702f6c6963656e7365)](https://packagist.org/packages/varunsridharan/sweetalert2-php)[![composer.lock available](https://camo.githubusercontent.com/ae85e15f5cb77d446979540447b0b64b1cbb641b6aa585d2d8af77aebd2d65b6/68747470733a2f2f706f7365722e707567782e6f72672f766172756e73726964686172616e2f7377656574616c657274322d7068702f636f6d706f7365726c6f636b)](https://packagist.org/packages/varunsridharan/sweetalert2-php)

---

👉 **This Custom PHP Lib depends on SweetAlert2 JS Lib and this php class works as Javascript code builder.**

---

Installation
------------

[](#installation)

The preferred way to install this extension is through [Composer](http://getcomposer.org/download/).

To install **VSP\_Framework library**, simply:

```
$ composer require varunsridharan/sweetalert2-php

```

The previous command will only install the necessary files, if you prefer to **download the entire source code** you can use:

```
$ composer require varunsridharan/sweetalert2-php --prefer-source

```

You can also **clone the complete repository** with Git:

```
$ git clone https://github.com/varunsridharan/sweetalert2-php.git

```

Or **install it manually**:

[Download VSP\_Framework.zip](https://github.com/varunsridharan/sweetalert2-php/archive/master.zip):

```
$ wget https://github.com/varunsridharan/sweetalert2-php/archive/master.zip

```

#### Notice

[](#notice)

```
$data = swal2('Success','Your Email is sent','success');
echo ''.$data.'';
```

#### Notice With Timer

[](#notice-with-timer)

```
$data = swal2('Success','Your Email is sent','success');
$data->timer(500);
echo ''.$data.'';
```

Useful Functions
----------------

[](#useful-functions)

#### Simple Notice

[](#simple-notice)

```
/**
 * @param string $title
 * @param string $content
 * @param string $type
 *
 * @return \SweetAlert2
 */
 swal2( $title = '', $content = '', $type = 'success' )
```

#### Success Notice

[](#success-notice)

```
/**
 * @param string $title
 * @param string $content
 *
 * @return \SweetAlert2
 */
 swal2_success( $title = '', $content = '' )
```

#### Info Notice

[](#info-notice)

```
/**
 * @param string $title
 * @param string $content
 *
 * @return \SweetAlert2
 */
 swal2_info( $title = '', $content = '' )
```

#### Question Notice

[](#question-notice)

```
/**
 * @param string $title
 * @param string $content
 *
 * @return \SweetAlert2
 */
 swal2_question( $title = '', $content = '' )
```

#### Warning Notice

[](#warning-notice)

```
/**
 * @param string $title
 * @param string $content
 *
 * @return \SweetAlert2
 */
 swal2_warning( $title = '', $content = '' )
```

#### Error Notice

[](#error-notice)

```
/**
 * @param string $title
 * @param string $content
 *
 * @return \SweetAlert2
 */
 swal2_error( $title = '', $content = '' )
```

---

📝 Changelog
-----------

[](#-changelog)

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

[Checkout CHANGELOG.md](https://github.com/varunsridharan/sweetalert2-php/blob/main/CHANGELOG.md)

🤝 Contributing
--------------

[](#-contributing)

If you would like to help, please take a look at the list of [issues](https://github.com/varunsridharan/sweetalert2-php/issues/).

📜 License &amp; Conduct
-----------------------

[](#--license--conduct)

- [**MIT License**](https://github.com/varunsridharan/sweetalert2-php/blob/main/LICENSE) © [Varun Sridharan](website)
- [Code of Conduct](https://github.com/varunsridharan/.github/blob/main/CODE_OF_CONDUCT.md)

📣 Feedback
----------

[](#-feedback)

- ⭐ This repository if this project helped you! 😉
- Create An [🔧 Issue](https://github.com/varunsridharan/sweetalert2-php/issues/) if you need help / found a bug

💰 Sponsor
---------

[](#-sponsor)

[I](https://sva.onl/twitter/) fell in love with open-source in 2013 and there has been no looking back since! You can read more about me [here](https://sva.onl/website/). If you, or your company, use any of my projects or like what I’m doing, kindly consider backing me. I'm in this for the long run.

- ☕ How about we get to know each other over coffee? Buy me a cup for just [**$9.99**](https://sva.onl/buymeacoffee)
- ☕️☕️ How about buying me just 2 cups of coffee each month? You can do that for as little as [**$9.99**](https://sva.onl/buymeacoffee)
- 🔰 We love bettering open-source projects. Support 1-hour of open-source maintenance for [**$24.99 one-time?**](https://sva.onl/paypal)
- 🚀 Love open-source tools? Me too! How about supporting one hour of open-source development for just [**$49.99 one-time ?**](https://sva.onl/paypal)

Connect &amp; Say 👋
-------------------

[](#connect--say-)

- **Follow** me on [👨‍💻 Github](https://sva.onl/github/) and stay updated on free and open-source software
- **Follow** me on [🐦 Twitter](https://sva.onl/twitter/) to get updates on my latest open source projects
- **Message** me on [📠 Telegram](https://sva.onl/telegram/)
- **Follow** my pet on [Instagram](https://www.instagram.com/sofythelabrador/) for some *dog-tastic* updates!

---

*Built With ♥ By [Varun Sridharan](https://sva.onl/twitter) [ ![](https://camo.githubusercontent.com/ac180da7a81f72a639abce09c4827e7bacfdd3b82586b657387a7f84430c7b7f/68747470733a2f2f63646e2e73766172756e2e6465762f666c61672d696e6469612e6a7067)](https://en.wikipedia.org/wiki/India)*

 [![](https://camo.githubusercontent.com/51991d58f40dac784a0c08b9c5c16c66c59ef5bdf083e3d49e4f617ef98e03ee/68747470733a2f2f63646e2e73766172756e2e6465762f636f64656973706f657472792e706e67)](https://camo.githubusercontent.com/51991d58f40dac784a0c08b9c5c16c66c59ef5bdf083e3d49e4f617ef98e03ee/68747470733a2f2f63646e2e73766172756e2e6465762f636f64656973706f657472792e706e67)

---

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~121 days

Recently: every ~177 days

Total

7

Last Release

1864d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/522dc9d037e4b0517ee9b76cd63d75a6331b0e578afa9b27fee84b02863ace80?d=identicon)[varunsridharan](/maintainers/varunsridharan)

---

Top Contributors

[![varunsridharan](https://avatars.githubusercontent.com/u/1884287?v=4)](https://github.com/varunsridharan "varunsridharan (25 commits)")

---

Tags

builderjavascript-modalphpphp-librarysweetalertsweetalert2vsp-libsphpbuildersweetalertsweetalert2javascript-modal

### Embed Badge

![Health badge](/badges/varunsridharan-sweetalert2-php/health.svg)

```
[![Health](https://phpackages.com/badges/varunsridharan-sweetalert2-php/health.svg)](https://phpackages.com/packages/varunsridharan-sweetalert2-php)
```

###  Alternatives

[gherkins/regexpbuilderphp

PHP port of thebinarysearchtree/regexpbuilderjs

1.4k163.0k1](/packages/gherkins-regexpbuilderphp)[godbout/dash-docset-builder

Dash (LOVE) Docset Builder in PHP (LOVE).

1253.5k](/packages/godbout-dash-docset-builder)[avplab/php-html-builder

PHP Html builder simplifies creation of an html code in php scripts. Allows to build (or generate) the html in simple natural way, similarly as create a html page.

189.2k](/packages/avplab-php-html-builder)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
