Coder Social home page Coder Social logo

Named Routes about route HOT 8 CLOSED

thephpleague avatar thephpleague commented on July 22, 2024
Named Routes

from route.

Comments (8)

philipobenito avatar philipobenito commented on July 22, 2024

Already in
On 12 Sep 2015 18:55, "Khayrattee Wasseem" [email protected] wrote:

Hi, I'm not sure if this is implemented yet. Would be cool to have named
routes.


Reply to this email directly or view it on GitHub
#68.

from route.

wkhayrattee avatar wkhayrattee commented on July 22, 2024

is it documented somewhere already? (would like to see syntax - thanks)

from route.

philipobenito avatar philipobenito commented on July 22, 2024

No, documentation isn't written yet but chain setName('name') on to any
mapping of a route.
On 12 Sep 2015 19:35, "Khayrattee Wasseem" [email protected] wrote:

is it documented somewhere already? (would like to see syntax - thanks)


Reply to this email directly or view it on GitHub
#68 (comment).

from route.

wkhayrattee avatar wkhayrattee commented on July 22, 2024

I've tried chaining, but get the following error:
Fatal error: Call to undefined method League\Route\RouteCollection::setName()

I'm using v1.2.3
Code sample:

public static function getRoutes(ContainerInterface $container)
{
    $routes = new RouteCollection($container);
    $routes->addRoute('GET', '/index', 'Controller\IndexController::index')->setName('welcome');
    //or even:
    //$routes->get('/index', 'Controller\IndexController::index')->setName('welcome');
    return $routes;
}

Anything I'm missing?

from route.

philipobenito avatar philipobenito commented on July 22, 2024

They're only available in v2, its not possible in v1
On 12 Sep 2015 21:21, "Khayrattee Wasseem" [email protected] wrote:

I've tried chaining, but get the following error:
Fatal error: Call to undefined method
League\Route\RouteCollection::setName()

I'm using v1.2.3
Code sample:

public static function getRoutes(ContainerInterface $container)
{
$routes = new RouteCollection($container);
$routes->addRoute('GET', '/index', 'Controller\IndexController::index')->setName('welcome');
//or even:
//$routes->get('/index', 'Controller\IndexController::index')->setName('welcome');
return $routes;
}

Anything I'm missing?


Reply to this email directly or view it on GitHub
#68 (comment).

from route.

wkhayrattee avatar wkhayrattee commented on July 22, 2024

ah! ok :)

Any time frame for the arrival of v2?

Thanks Phil, I think that's it for me for today :)
Thank you for everything and for all you do!

cheers!

from route.

philipobenito avatar philipobenito commented on July 22, 2024

Hoping to have it tagged and documented by tomorrow or Monday :-) if you
enjoy a code dive, the develop branch is very close to finished
On 12 Sep 2015 21:36, "Khayrattee Wasseem" [email protected] wrote:

ah! ok :)

Any time frame for the arrival of v2?

Thanks Phil, I think that's it for me for today :)
Thank you for everything and for all you do!

cheers!


Reply to this email directly or view it on GitHub
#68 (comment).

from route.

wkhayrattee avatar wkhayrattee commented on July 22, 2024

yes sure, will keep an eye on the develop branch

from route.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.