Rapid prototyping with Symfony.

Using Symfony’s crud functionality.

Rapid prototyping is really easy with Symfony.

Symfony’s maker bundle allows you to create a simple app really quick and visualize the functionality that you desire.

Use composer to install maker bundle

composer req --dev maker

Then do

composer list make

To see the list of make commands.

The ones that we are interested in are

make:entity and make:crud

That along with the migration commands from doctrine will let you do the job.

A quick Todo application

Use Symfony binary to create a new project.

symfony new todo --full

–full will tell the binary to install the full-stack version of the framework.

You don’t need to install maker separately

cd todo
symfony serve -d
symfony open:local

That will open the webserver and you can see your new symfony application.

symfony console make:entity

That will prompt you to enter the name of the entity and and its properties.

Input Todo and create a description with type string and done with type boolean.

symfony console make:migration

to create the database migration.

symfony console doctrine:migrations:migrate 

To apply the changes to the database. Make sure you change the database access information in .env file in the project root.

symfony console make:crud 

To generate the crud behaviour. Enter the entity Todo here.

When the command finishes go to /todo route to see the new list, add, delete, edit functionality.

That’s it.

When this combined with other symfony functionality such as bootstrap integration, you get a not so bad looking application very quick.

Obviously if you need more complex logic, put them in services and use that, or use a domain model etc.

0

(Visited 1 times, 1 visits today)