Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter HTMX
#1

CodeIgniter HTMX

This is a helper library for HTMX. A set of methods for IncomingRequest, Response, and RedirectResponse classes to help you work with HTMX fluently in the CodeIgniter 4 framework.

It also provides some additional help with handling errors in development mode as well as support for view fragments.

You can read all the details in the documentation.

There is also a separate repo with demos that covers many use cases, like:
  • Books - searching, pagination, inline edit
  • Tasks - events
  • Paragraphs - sorting, modal edit
  • Controller Cells - widget-like components
If you're new to HTMX, demos will help you to get familiar with some basic use cases and strategies you can use during the development of real-world apps.
Reply
#2

Looks like a great helper library. The search feature in the demo app, last tab, triggers an error for error handling demoing, I suppose?

Is there any way to make it work with php 7.4 ? I dread upgrading the four projects on the production server...
==

Donatas G.
Reply
#3

(01-15-2023, 03:22 AM)dgvirtual Wrote: Looks like a great helper library. The search feature in the demo app, last tab, triggers an error for error handling demoing, I suppose?

Is there any way to make it work with php 7.4 ? I dread upgrading the four projects on the production server...

Thanks, there was indeed an error caused when trying to search the books. This has now been fixed.

I have no plans of supporting PHP 7.4, but you can certainly install this library manually and make the necessary changes. I would search for things like match, str_starts_with and union types in method parameters. It shouldn't be hard.
Reply
#4

[quote pid="405307" dateline="1673779217"]
I have no plans of supporting PHP 7.4, but you can certainly install this library manually and make the necessary changes. I would search for things like match, str_starts_with and union types in method parameters. It shouldn't be hard.
[/quote]
Thanks, it was not hard actually. I have created a fork and made it work with php7, here: https://github.com/dgvirtual/codeigniter-htmx

One can install it manually and the @michalsn's  codeigniter-htmx-demo app seems to work flawlessly with it (the demo app itself seems not to contain any PHP8-only code).

I did not test it the proper way though; I tried running composer test and

For now, unfortunately, I was unable to add a possibility to install it via composer. Tried this:

adding to the app's composer.json file repositories key:
Code:
    "repositories": {
        "codeigniter-htmx": {
            "type": "vcs",
            "url": "[email protected]:dgvirtual/codeigniter-htmx.git"
        },
    }
and then issuing command
Code:
composer require michalsn/codeigniter-htmx:php7port

still complains about PHP version:
Code:
  [InvalidArgumentException]                                                                                                       
  Package michalsn/codeigniter-htmx has a PHP requirement incompatible with your PHP version, PHP extensions and Composer version: 
    - michalsn/codeigniter-htmx v1.1.0 requires php ^8.0 which does not match your installed version 7.4.3. 
And if one tries to ignore the PHP version:
Code:
composer require michalsn/codeigniter-htmx:dev-php7port  --ignore-platform-reqs
Composer still complains:
Code:
[InvalidArgumentException]                                                                                           
  Could not find package michalsn/codeigniter-htmx in a version matching "dev-php7port" and a stability matching "dev".
If anyone could look into that, we could make it installable via composer.
==

Donatas G.
Reply
#5

@dgvirtual - please check these instructions: https://getcomposer.org/doc/05-repositor...repository

The alternative would be to create your own composer package.
Reply
#6

Ah, so changing the vendor in package.json must have been the problem... will revert to original line.
==

Donatas G.
Reply
#7

OK, so composer installation works now; to install in an existing composer project, run in command line:

composer config minimum-stability dev
composer config repositories.codeigniter-htmx vcs [email protected]:dgvirtual/codeigniter-htmx.git
composer require michalsn/codeigniter-htmx:dev-php7port

@michalsn, maybe you know if there is any way for me to automatically find out when your library get's updated, so I can update the port?
==

Donatas G.
Reply
#8

@dgvirtual I'm not aware of anything you can do about it. The only option would be to subscribe to the repo changes and then merge them into your project after any significant update. At least up to my knowledge.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB