New greener region discount. Save 3% on Upsun resource usage. Learn how.
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.

FAQ

How does Upsun ensure seamless updates and maintenance for Symfony applications?
Upsun ensures seamless updates and maintenance for Symfony applications by providing automated deployment workflows and environment management. Updates can be tested in isolated environments before being promoted to production, minimizing the risk of downtime. Additionally, Upsun’s rollback capabilities allow you to quickly revert to a previous stable version if an update causes issues, ensuring continuous application availability.

What support does Upsun offer for database management in Symfony applications?
Upsun offers comprehensive support for database management in Symfony applications, including automated backups, replication, and scaling options. You can easily configure database connections and manage credentials using the .upsun/config.yaml file. Upsun also provides tools for database migration and synchronization across different environments, ensuring data consistency and integrity throughout the development lifecycle.

How can I leverage Upsun’s networking capabilities to improve the performance of my Symfony application?
Upsun’s networking capabilities can be leveraged to improve the performance of your Symfony application by utilizing features such as load balancing, CDN integration, and optimized network routes. Load balancing distributes incoming traffic across multiple instances, reducing the load on any single server. Integrating a CDN can speed up content delivery to users around the globe. Additionally, Upsun’s optimized network routes ensure low-latency communication between services and databases, enhancing overall application responsiveness.

Upsun Logo
Join the community
X logoLinkedin logoGithub logoYoutube logoTiktok logo