We need a code editor, for PHP you can use NetBeans (https://netbeans.org/features/php/) or PHP Storm (https://www.jetbrains.com/phpstorm/)

Inside the project folder there are some directory:
– app
– bin
– src
– tests
– var
– vendor
– web
– composer.json
– LICENSE etc…

Focus on:

A. src: it holds all PHP files (classes)

B. app: it holds configuration, templates

Let’s move on!

1. Go to src/AppBundle/Controller/DefaultController.php, this in the default welcome page, delete it.
Now we have a real empty project :)

2. We need to create a ‘route’ and a ‘controller’
The route is where is the page, its url in poor words.
The controller is a software program that manages or directs the flow of data between two entities, it is the function that build the page.

3. Create inside AppBundle\Controller\GenusController.php

<?php

namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;  // namespace for route
use Symfony\Component\HttpFoundation\Response;               // namespace for http render

class GenusController 
{
	/**
	* @Route("/genus")
	*/
	public function showAction() // this is the controller that create the page, returns a Response Object
	{
		return new Response('Under the <strong>Sea!</strong>'); // HTTP Text Render
	}
	
}


NOTICE:

– namespace AppBundle\Controller … use etc…: a Symfony namespace necessary for development

– class GenusController: the name of php file GenusController.php
We have created a class named GenusController that can be find by Symfony at src\AppBundle\Controller

– We use this particular syntax to define the http route of the page

/**
* @Route(“/genus”)
*/

It will be http://localhost/symfonytest/first_test_symfony/web/genus

– Controller to create the page:


	public function showAction() // this is the controller that create the page, returns a Response Object
	{
		return new Response('Under the <strong>Sea!</strong>'); // HTTP Text Render
	}
	

Run from the browser: http://localhost/symfonytest/first_test_symfony/web/genus

Official Link:
Ref: http://knpuniversity.com/screencast/symfony/first-page