Table of Contents
While doing any operation in any application we want some confirmation alerts like for success, warning, error. Why we need these. It’s because it gives a more readable power to end users to understand what’s happening.
Inside this article we will implement or add bootstrap growl jquery notification to CodeIgniter 4 application. This is CodeIgniter 4 application specific. You can use in any application of PHP.
To learn about Sweetalert2 jQuery notification plugin to CodeIgniter 4, Click here.
This article will cover about using Bootstrap growl jquery plugin for message notifications to end user.
Note*: For this article, CodeIgniter v4.1 setup has been installed. May be when you are seeing, version will be updated. CodeIgniter 4.x still is in development mode.

Step by step we will see their needed plugin files and implementation.
Let’s get started.
Download & Install CodeIgniter 4 Setup
We need to download & install CodeIgniter 4 application setup to system. To set application we have multiple options to proceed. Here are the following ways to download and install CodeIgniter 4 –
- Manual Download
- Composer Installation
- Clone Github repository of CodeIgniter 4
Complete introduction of CodeIgniter 4 basics – Click here to go. After going through this article you can easily download & install setup.
Here is the command to install via composer –
$ composer create-project codeigniter4/appstarter codeigniter-4
Assuming you have successfully installed application into your local system.
Settings Environment Variables
When we install CodeIgniter 4, we have env file at root. To use the environment variables means using variables at global scope we need to do env to .env
Open project in terminal
$ cp env .env
Above command will create a copy of env file to .env file. Now we are ready to use environment variables.
CodeIgniter starts up in production mode by default. Let’s do it in development mode. So that while working if we get any error then error will show up.
# CI_ENVIRONMENT = production // Do it to CI_ENVIRONMENT = development
Now application is in development mode.
Required Plugin Files
Bootstrap Growl jQuery plugin file
JS File
https://cdnjs.cloudflare.com/ajax/libs/bootstrap-growl/1.0.0/jquery.bootstrap-growl.min.js
Bootstrap CSS File
https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css
We need a plugin JS file and a CSS file (It’s same as bootstrap css what we need) for its layout styling. After adding these plugin files, we are allowed to use it’s method like –
$.bootstrapGrowl("<Message Here>", {})
Implementing Bootstrap Growl jQuery Plugin
Let’s create a simple application where we will see the step by step implementation of bootstrap growl jQuery plugin files.
Create Route
Routes can be configured into Routes.php which is at /app/Config folder.
//... Other routes $routes->get('notification', 'MessageController::showGrowlMessages');
Create Controller
$ php spark make:controller Message –suffix
Open MessageController.php from /app/Controllers
<?php namespace App\Controllers; use App\Controllers\BaseController; class MessageController extends BaseController { public function showGrowlMessages() { // Flash messages settings session()->setFlashdata("success", "This is success message"); session()->setFlashdata("warning", "This is warning message"); session()->setFlashdata("info", "This is information message"); session()->setFlashdata("error", "This is error message"); return view("growl-notification"); } }
Create Blade Template File
Create a file with name growl-notification.php at /app/Views folder. Open file and write this code into it.
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-growl/1.0.0/jquery.bootstrap-growl.min.js"></script> <script> $(function(){ <?php if(session()->has("success")) { ?> $.bootstrapGrowl('<?= session("success") ?>',{ type: 'success', delay: 4000, }); <?php } ?> <?php if(session()->has("info")) { ?> $.bootstrapGrowl('<?= session("info") ?>',{ type: 'info', delay: 4000, }); <?php } ?> <?php if(session()->has("error")) { ?> $.bootstrapGrowl('<?= session("error") ?>',{ type: 'danger', delay: 4000, }); <?php } ?> <?php if(session()->has("warning")) { ?> $.bootstrapGrowl('<?= session("warning") ?>',{ type: 'warning', delay: 4000, }); <?php } ?> }); </script>
Right now we are displaying these notification messages without any operations like insert, update or anything but you can use it for your application notifications.
Application Testing
Start development server:
$ php spark serve
URL – http://localhost:8080/notification

Plugin Error If not Linked Properly
If suppose we missed the plugin files to attach or let’s say not linked properly, then at console tab we will get something.
$.bootstrapGrowl is not a function
We hope this article helped you to learn about i.e Bootstrap Growl jQuery Notification to CodeIgniter 4 Tutorial in a very detailed way.
If you liked this article, then please subscribe to our YouTube Channel for PHP & it’s framework, WordPress, Node Js video tutorials. You can also find us on Twitter and Facebook.
Find More on CodeIgniter 4 here
- CodeIgniter 4 Cookie Helper Tutorial
- CodeIgniter 4 CRUD Application Tutorial
- CodeIgniter 4 CRUD REST APIs Tutorial
- CodeIgniter 4 CSRF Token in AJAX Request
- Database Query in CodeIgniter 4 Tutorial
- CodeIgniter 4 Ajax Form Data Submit
- CodeIgniter 4 Form Validation Tutorial
- CodeIgniter 4 Image Upload with Form Tutorial
- Multi language in CodeIgniter 4 Tutorial
- Stripe Payment Gateway Integration in CodeIgniter 4
- CodeIgniter 4 CSRF Token Tutorial
- CodeIgniter 4 Basics Tutorial
- CodeIgniter 4 Spark CLI Commands Tutorial
- Migration in CodeIgniter 4 Tutorial
- Seeders in CodeIgniter 4 Tutorial
Hi, I am Sanjay the founder of ONLINE WEB TUTOR. I welcome you all guys here to join us. Here you can find the web development blog articles. You can add more skills in web development courses here.
I am a Web Developer, Motivator, Author & Blogger. Total experience of 7+ years in web development. I also used to take online classes including tech seminars over web development courses. We also handle our premium clients and delivered up to 50+ projects.