https://github.com/michalsn/codeigniter-htmx-alerts
A simple Alerts class integrated with htmx and Alpine.js for CodeIgniter 4 framework.
https://github.com/michalsn/codeigniter-htmx-alerts
alpinejs codeigniter codeigniter4 htmx
Last synced: 17 days ago
JSON representation
A simple Alerts class integrated with htmx and Alpine.js for CodeIgniter 4 framework.
- Host: GitHub
- URL: https://github.com/michalsn/codeigniter-htmx-alerts
- Owner: michalsn
- License: mit
- Created: 2024-09-11T05:54:39.000Z (8 months ago)
- Default Branch: develop
- Last Pushed: 2024-10-21T05:35:30.000Z (6 months ago)
- Last Synced: 2025-02-16T15:51:10.250Z (2 months ago)
- Topics: alpinejs, codeigniter, codeigniter4, htmx
- Language: PHP
- Homepage:
- Size: 36.1 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CodeIgniter Htmx Alerts
A simple Alerts class integrated with [htmx](https://htmx.org) and [Alpine.js](https://alpinejs.dev) for CodeIgniter 4 framework.
[](https://github.com/michalsn/codeigniter-htmx-alerts/actions/workflows/phpunit.yml)
[](https://github.com/michalsn/codeigniter-htmx-alerts/actions/workflows/phpstan.yml)
[](https://github.com/michalsn/codeigniter-htmx-alerts/actions/workflows/deptrac.yml)
[](https://coveralls.io/github/michalsn/codeigniter-htmx-alerts?branch=develop)
## Installation
composer require michalsn/codeigniter-htmx-alerts:dev-develop
## Configuration
You have to publish the config file first:
php spark alerts:publish
Now you can change:
#### $key
Alerts key name used in views and session.
#### $displayTime
The default alert display time in milliseconds.
#### $types
The array of message types, where array key is a CSS class and value is the title of the alert type.
Array keys are also used to determine the type of the alert we want to set, ie:
```php
alerts()->set('success', 'Success message goes here.');
```#### $htmlWrapperId
Wrapper `id` name, used in the view file.
#### $views
View files used by this library. You can change them to reflect the current style/theme you're using.
The default view files are designed to play along with [Tabler](https://tabler.io/admin-template) theme.
## Usage
In your main layout place the code (usually it will be just before the closing `