Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Pretty efficient URL Router in PHP.
JavaScript PHP
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
lib
tests
README.markdown

README.markdown

CRouting

Yet another URL router/matcher, inspired by Symfony.

I believe I implemented a symfony-like URL routing. In order to keep things faster, instead of dump the rules, it generated PHP code out of it.

TODO:

  • support for /* (so it can match with the base URL and anything else)
  • Add concept of URL separators (single char):

    foo:
        pattern: /{foo}.{ext}
        defaults: {ext: json}
        requirements:
            ext: php|json|xml
    bar:
        pattern: /{foo}bar{ext}
        defaults: {ext: json}
        requirements:
            ext: php|json|xml
    
    --
    /something (match)
    /something.php (match)
    /extrabarjson (match)
    /extrabarphp (match)
    /extrabar (match)
    /something. (will fail)
    
  • Add validation to the URL generation function. Return nice URL if some optional parametter is missing

  • add docblock for methods
  • documentation
  • use substr_compare for simple comparition
Something went wrong with that request. Please try again.