Creating a new page - whether it's an HTML page or a JSON endpoint - is a
simple two-step process:

Create a route: A route is the URL (e.g. /about) to your page and
points to a controller;

Create a controller: A controller is the PHP function you write that
builds the page. You take the incoming request information and use it to
create a Symfony Response object, which can hold HTML content, a JSON
string or even a binary file like an image or PDF.

Before continuing, make sure you've read the Setup
chapter and can access your new Symfony app in the browser.

Suppose you want to create a page - /lucky/number - that generates a lucky (well,
random) number and prints it. To do that, create a "Controller class" and a
"controller" method inside of it that will be executed when someone goes to
/lucky/number:

If you're using the built-in PHP web-server, you can omit the app_dev.php
part of the URL.

If you see a lucky number being printed back to you, congratulations! But before
you run off to play the lottery, check out how this works. Remember the two steps
to creating a page?

Create a route: The @Route above numberAction() is the route: it
defines the URL pattern for this page. You'll learn more about routing
in its own section, including how to make variable URLs;

Create a controller: The method below the route - numberAction() - is called
the controller: this is a function where you build the page and ultimately
return a Response object. You'll learn more about controllers
in their own section, including how to return JSON responses;

If your page is working, then you should also see a bar along the bottom of your
browser. This is called the Web Debug Toolbar: and it's your debugging best friend.
You'll learn more about all the information it holds along the way, but feel free
to experiment: hover over and click the different icons to get information about
routing, performance, logging and more.

Your Symfony application comes pre-installed with a collection of bundles, like
FrameworkBundle and TwigBundle. Bundles are similar to the idea of a plugin,
but with one important difference: all functionality in a Symfony application comes
from a bundle.

Bundles are registered in your app/AppKernel.php file (a rare PHP file in the
app/ directory) and each gives you more tools, sometimes called services:

For example, TwigBundle is responsible for adding the Twig tool to your app!

Eventually, you'll download and add more third-party bundles to your app in order
to get even more tools. Imagine a bundle that helps you create paginated lists.
That exists!

You can control how your bundles behave via the app/config/config.yml file.
That file - and other details like environments & parameters - are discussed in
the Configuring Symfony (and Environments) chapter.