Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8028469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:08:40+00:00 2026-06-05T00:08:40+00:00

With Silex (the PHP micro framework), it’s possible to give names to existing controllers,

  • 0

With Silex (the PHP micro framework), it’s possible to give names to existing controllers, so that we can easily generate urls to them later. Example:

$app->get('/gallery', function () {...})
    ->bind('gallery');

// Later on, in a template
{{ path('gallery') }}

I think this is really useful and I can’t live without it.

But is it possible to register a route to an external website ? Say I’d like to generate urls to a google search, kind of

{{ path('google', {'search':'symfony'}) }}
// Would render to http://google.com/search?q=symfony

I take any idea 🙂 Thx for your help !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T00:08:41+00:00Added an answer on June 5, 2026 at 12:08 am

    path() is a Twig Extension for routing. Routing is to route an incoming URL to a controller action.

    You can, however, create your own twig extension if you want a helper to easily create those standard outgoing URLs.

    Take a look at: http://symfony.com/doc/current/cookbook/templating/twig_extension.html

    You could then create an extension that turns {{ google('search string') }} into a URL. Only the imagination is your boundary.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i've got a project in php-silex, but i beging with this framework. I create
I'm currently using Silex for a small project. I've registered the form service that
I am currently refactoring a Silex\Application that has grown bigger than initially expected. As
My application file: <?php // /src/app.php require_once __DIR__ . '/../lib/vendor/Sensio/silex.phar'; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response;
I am wanting to use the Symfony\Component\Process\ProcessBuilder class and can see that it is
I try to use the Silex framework as base for my web application. However,
How can I reverse the results of a shlex.split ? That is, how can
Is it possible to use Twig in Silex from Symfony2 project instead from the
I would like to get a two dimensional int array arr that I can
I'm developing an application that can turn off the sound of Android Phone automatically.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.