michalsn / codeigniter-htmx-demo

This is a demo for CodeIgniter HTMX helper library.
https://michalsn.github.io/codeigniter-htmx/
MIT License
60 stars 13 forks source link

CodeIgniter HTMX Demo

This is a demo for CodeIgniter HTMX helper library. Demo requires:

CodeIgniter HTMX Demo

Available demos:

Installation

  1. Install CodeIgniter 4 with composer (command below) or manually.
    composer create-project codeigniter4/appstarter codeigniterhtmx
    cd codeigniterhtmx
  2. Install CodeIgniter HTMX library with composer (command below) or manually.
    composer require michalsn/codeigniter-htmx
  3. Manually download ZIP file of this project and place it in the desired folder.

    • The example will assume that it will be codeigniterhtmx/app/ThirdParty/htmx-demo.
    • Then enable it by editing the codeigniterhtmx/app/Config/Autoload.php file and adding the Michalsn\CodeIgniterHtmxDemo namespace to the $psr4 array, like in the below example:
<?php

// ...

public $psr4 = [
    APP_NAMESPACE => APPPATH, // For custom app namespace
    'Config'      => APPPATH . 'Config',
    'Michalsn\CodeIgniterHtmxDemo' => APPPATH . 'ThirdParty/htmx-demo/src',
];

// ...

Database

First, make sure to create a database for the project. You can name it codeigniterhtmx and set credentials for the database connection in codeigniterhtmx/app/Config/Database.php, see framework's user guide for more information.

Before running the examples you have to migrate the database. Make sure you have set correct credentials to the database and then run the command:

php spark migrate --all

And preferably run the seeds:

For Unix:

php spark db:seed Michalsn\\CodeIgniterHtmxDemo\\Database\\Seeds\\SeedDemo

For Windows:

php spark db:seed Michalsn\CodeIgniterHtmxDemo\Database\Seeds\SeedDemo

Running the demo

The default route to the demo page is demo.