Webinar. Discover how universities like Mizzou and Colby moved 200+ sites to the cloud. Register here
LoginFree trial
FeaturesPricingBlogAbout us
Blog

Up(sun) and running with Symfony Demo

symfonyCLIconfiguration
17 April 2024
Florent Huck
Florent Huck
DevRel Engineer

Focus more on creating incredible user experiences and less on Symfony infrastructure management—as well as a few Symfony Demo development tips along the way—with this simple, two-step guide. Learn how to host and configure your Symfony Demo project on Upsun, and get up and running as smoothly as possible. 

How to start using Symfony Demo on Upsun 

Create an Upsun-ready Symfony Demo

Creating a new Symfony Demo application is simple. Use the following commands to get your Symfony Demo project Upsun-ready, and don’t forget to add --upsun option to your command to auto-configure your local project for our PaaS: 

symfony new my-symfony-app --demo --upsun
cd my-symfony-app
symfony server:start -d #optional
Please note: if you’re starting from an existing local Symfony project, you can generate the Upsun config by using the following command:

symfony project:init --upsun

The --upsun option generates an Upsun YAML configuration file—.upsun/config.yaml—to manage how your application behaves when deployed on Upsun. This YAML configuration file is located in an .upsun/ folder, at the root of your source code, the architecture of which will look like this: 

my-symfony-app
├── .upsun
│   └── config.yaml
└── <project sources>

There are a few basic rules for Upsun configuration: 

  1. The YAML format is used for config files.
  2. The .upsun/ folder, containing a config.yaml file, with routes, services, and application configuration shared across all applications, must stay at the root of your project.

Finally, for this step, you need to create an Upsun project using the Symfony CLI.

2. Create an Upsun project and deploy

The next step in setting up your Symfony Demo application on Upsun is to create a project that is simple to do via the Upsun CLI in your terminal. Use this command and follow the prompts to choose the name of your project, region, and many other options: 

symfony project:create
Please note: During project creation, you are asked if you want to set the local remote to your new project. Enter Yes (y). Your local source code is automatically linked to your newly created Upsun project by creating a .upsun/local/project.yaml file. This file will contain the corresponding <projectId> and set a Git remote to upsun.

Then, deploy your local code to your Upsun project by using the following command:

symfony deploy

When the deployment is complete, browse your website using your favorite browser by using the following command:

symfony environment:url

You’re all set!

Hosting a Symfony application on Upsun has never been so easy—with just the 5 commands detailed above, you can be Up(sun) and running in no time. 

symfony new my-symfony-app --demo --upsun
cd my-symfony-app
symfony project:create
symfony deploy
symfony environment:url

Keep an eye out for an upcoming article from me on how to use FrankenPHP in this Symfony Demo application on Upsun—follow us on our social channels to stay up-to-date: Dev.toReddit, and Discord

Want to learn more about restructuring Symfony code without messing with functionality? You can dive into the topic of refactoring monolith to multi-application code with me in this video tutorial.
Upsun Logo
Join the community