Skip to content

Conversation

lonnieezell
Copy link
Member

@lonnieezell lonnieezell commented Oct 8, 2025

Description

As discussed here, this pulls out the subdomain detection logic from the restrict controller attribute into a helper method in the url_helper. It pulls the TLDs list into a new config file so users can easily customize this list. Replaced the current RouteCollection subdomain detection with this new feature as it's more complete.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@lonnieezell lonnieezell requested a review from michalsn October 8, 2025 20:44
Co-authored-by: Pooya Parsa <pooya_parsa_dadashi@yahoo.com>
@neznaika0
Copy link
Contributor

I wouldn't add the participants' local domains to the config. Sorry, if everyone adds their own region, it will be unnecessary.
My regions > 70 domains (com.ru, pp.ru, msk.ru...)

Try generating the docs, I think there's an error:
364 .. php:function:: parse_subdomain($hostname])

I don't quite understand what the function limits?

@michalsn michalsn added the 4.7 label Oct 9, 2025
Copy link
Member

@michalsn michalsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! That's a really nice improvement.

@lonnieezell
Copy link
Member Author

Thanks for the reviews!

@lonnieezell lonnieezell merged commit 01a45be into codeigniter4:4.7 Oct 10, 2025
50 checks passed
@lonnieezell lonnieezell deleted the subdomain-detection branch October 10, 2025 07:36
lonnieezell added a commit to lonnieezell/CodeIgniter4 that referenced this pull request Oct 10, 2025
* refactor(app): Standardize subdomain detection logic

* Update app/Config/Hostnames.php

Co-authored-by: Pooya Parsa <pooya_parsa_dadashi@yahoo.com>

* Update tests/system/Helpers/URLHelper/MiscUrlTest.php

Co-authored-by: Pooya Parsa <pooya_parsa_dadashi@yahoo.com>

* addressing review comments

* cs fix

* cs fix

* cs fix

* remove typo in docs ci-skip

---------

Co-authored-by: Pooya Parsa <pooya_parsa_dadashi@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants