Installation and Configuration Symfony Framework
Last Updated :
10 May, 2020
Symfony is an open-source PHP web application framework with MVC architecture. It is a set of reusable PHP components/libraries. It is basically designed for developers who need an elegant and simple toolkit to create web applications and is the most popular application frameworks among the open-source developer’s community. It is used to build high-performance complex web applications.
Prerequisites:
Installation:
First Project: Here we will create a Hello World page in three steps.
- Step 1: Create a new file named “HelloController.php” in src/Controller/ folder and write the following code in that file.
<?php
namespace App\Controller;
use Symfony\Component\HttpFoundation\Response;
class HelloController
{
public function hello()
{
return new Response(
'Hello World'
);
}
}
|
- Step 2: Open config/routes.yaml file and write the following code in that file.
app_hello:
path: /
controller: App\Controller\HelloController::hello
|
- Step 3: Goto localhost/project_1/public.
If you see something like this then you have successfully created hello world page.
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...