Time to test Symfony 4… or at least let’s test the experience of developing Symfony 4 projects with Symfony 3.3. Keep in mind that all the tools are in preview mode. Features might evolve over time. I’m waiting for your feedback! The first stable version of Symfony Flex will not be released before Symfony 4 at the end of November 2017. It gives the community plenty of time to discuss the changes I have described in this series of blog posts.

Creating a new Project

The first step is to create a project. Currently, this needs to be done via composer create-project. We might release a tool to bootstrap a project faster.

composer create-project "symfony/skeleton:^3.3" demo
cd demo
git init
git add .
git commit -m "initial set of files"
###> symfony/framework-bundle ###
APP_ENV=dev
APP_DEBUG=1
APP_SECRET=ODtvoHW6pn3bE2rHgTa2MjkjwefzlsJH
###< symfony/framework-bundle ###
return [
'Symfony\Bundle\FrameworkBundle\FrameworkBundle' => ['all' => true],
];
composer req webserver
composer req cli
composer req cli:next
composer rem cli
composer req admin
<?phpnamespace App\Entity;use Doctrine\ORM\Mapping as ORM;/**
* @ORM\Entity
* @ORM\Table(name="product")
*/
class Product {
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
public $id;
/**
* @ORM\Column(type="string", length=100)
*/
public $name;
/**
* @ORM\Column(type="decimal", scale=2)
*/
public $price;
/**
* @ORM\Column(type="text")
*/
public $description;
}
###> doctrine/doctrine-bundle ###
DATABASE_URL=mysql://root@127.0.0.1:3306/symfony?charset=utf8mb4
###< doctrine/doctrine-bundle ###
./bin/console doctrine:database:create
./bin/console doctrine:schema:update --force
easy_admin:
entities:
- App\Entity\Product
Symfony Flex in action to create an API project
  • req-checker to install the Symfony requirements checks;
  • log to install MonologBundle and all its dependencies;
  • template for Twig;
  • mailer for Swiftmailer;
  • profiler for the profiler;
  • … you get the point :)

founder and CEO @SensioLabs and @blackfireio, founder and project lead @Symfony