slimphp / Slim

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.
http://slimframework.com
MIT License
11.98k stars 1.95k forks source link

setPattern() in Slim 3.x? #1669

Closed tachyon-ops closed 8 years ago

tachyon-ops commented 8 years ago

Hi there,

How can I dynamically assign setPattern in Slim 3.x?

tachyon-ops commented 8 years ago

So, with the help of @akrabat on #slimphp freenode channel I accomplished this making a setter in Slim's Routable.php;

   /**
     * Set the route pattern
     *
     * @set string
     */
    public function setPattern($newPat)
    {
        $this->pattern = $newPat;
    }

I suggest this to be implemented in the code.

tachyon-ops commented 8 years ago

User case:

i18n dynamic assignment through named routes. configuration driven urls ...

akrabat commented 8 years ago

I'm not adverse to someone creating a PR for this.