Skip to content

Add Router::url() support to HTMX response methods#16

Merged
zunnu merged 1 commit intozunnu:mainfrom
josbeir:main
Dec 3, 2025
Merged

Add Router::url() support to HTMX response methods#16
zunnu merged 1 commit intozunnu:mainfrom
josbeir:main

Conversation

@josbeir
Copy link
Copy Markdown
Contributor

@josbeir josbeir commented Nov 5, 2025

This PR updates the HtmxComponent to support flexible URL formats using CakePHP's Router::url() method for better integration with CakePHP's routing system.

Updated Methods:

  • location()
  • pushUrl()
  • replaceUrl()
  • redirect()

Now Accepts:

  • String URLs: '/posts/view/1'
  • Array routing: ['controller' => 'Posts', 'action' => 'view', 1]
  • PSR-7 UriInterface objects
  • null values

Example:

// Before - only strings
$this->Htmx->redirect('/posts/view/1');

// After - also supports arrays
$this->Htmx->redirect(['controller' => 'Posts', 'action' => 'view', 1]);

Additional Changes

  • Fixed PHPUnit XML configuration deprecation warning

@josbeir
Copy link
Copy Markdown
Contributor Author

josbeir commented Nov 17, 2025

ping @zunnu

@zunnu
Copy link
Copy Markdown
Owner

zunnu commented Nov 19, 2025

ping @zunnu

Thanks for the PR! Sorry for the late reply been really swamped recently. I will make sure to check this out ASAP.

@zunnu zunnu merged commit f5ad540 into zunnu:main Dec 3, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants