Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 3 months ago
JSON representation

A simple Alerts class integrated with htmx and Alpine.js for CodeIgniter 4 framework.

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.

[![PHPUnit](https://github.com/michalsn/codeigniter-htmx-alerts/actions/workflows/phpunit.yml/badge.svg)](https://github.com/michalsn/codeigniter-htmx-alerts/actions/workflows/phpunit.yml)
[![PHPStan](https://github.com/michalsn/codeigniter-htmx-alerts/actions/workflows/phpstan.yml/badge.svg)](https://github.com/michalsn/codeigniter-htmx-alerts/actions/workflows/phpstan.yml)
[![Deptrac](https://github.com/michalsn/codeigniter-htmx-alerts/actions/workflows/deptrac.yml/badge.svg)](https://github.com/michalsn/codeigniter-htmx-alerts/actions/workflows/deptrac.yml)
[![Coverage Status](https://coveralls.io/repos/github/michalsn/codeigniter-htmx-alerts/badge.svg?branch=develop)](https://coveralls.io/github/michalsn/codeigniter-htmx-alerts?branch=develop)

![PHP](https://img.shields.io/badge/PHP-%5E8.1-blue)
![CodeIgniter](https://img.shields.io/badge/CodeIgniter-%5E4.3-blue)

## Installation

composer require michalsn/codeigniter-htmx-alerts

## 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 `