To start with Symfony we need to have composer installed in our system first. If you haven't installed it yet, you can Click Here to go to my blog on installing composer globally
Step 1: once you are done with installing the composer.Simply open vs code editor and open terminal. on that terminal enter the following commands
composer create-project symfony/skeleton my-project-name;
this command will install the latest symfony project at the given destination.
Step 2: Enter following commands
cd my-project // for going to our Symfony project directory we just created
php -S 127.0.0.1:8000 -t public // to start development server on localhost
now just go to your browser and enter http://127.0.0.1:8000/ on search bar and hit . You will get page like this
This screen means you have successfully installed a symfony project.
Step 3: To check if your project complete all requirements enter following commands
$ composer require symfony/requirements-checker
once this command is executed and whatever be the requirements is installed , you can check page http://127.0.0.1:8000/check.php after that
we could just remove it back to by command
$ composer remove symfony/requirements-checker.
Step 3: to download all the requirements or to handle views etc install twig(extention)
$ composer require twig
Step 4: for installing database enter command
$ composer require doctrine;
==============================setup is done=============================
now some additional information about symfony imp file locations
Controllers : src/Controller/ControllerName.php
Enteties(works like model in symfony ) : src/Entity/EntityName.php
Views : templates/viewname.html.twig
to make controller , Enteties and view all at one time we can install a package name maker
$ composer require maker;
after installing this package , you could just enter this command to make controller name DefaultController
$ bin/console make: controller DefaultController;
this would automatically create one controller and associated view file . you can see this page on this url http://127.0.0.1:8000/default
0 Comments