{"id":34585154,"url":"https://github.com/planetscale/symfony-example","last_synced_at":"2026-05-29T04:31:11.508Z","repository":{"id":43779813,"uuid":"460578297","full_name":"planetscale/symfony-example","owner":"planetscale","description":"Connect a sample Symfony app to PlanetScale","archived":false,"fork":false,"pushed_at":"2026-05-06T11:14:25.000Z","size":93,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-06T13:24:46.339Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/planetscale.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-17T19:28:52.000Z","updated_at":"2025-03-19T10:33:10.000Z","dependencies_parsed_at":"2023-02-09T17:00:37.323Z","dependency_job_id":null,"html_url":"https://github.com/planetscale/symfony-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/planetscale/symfony-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Fsymfony-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Fsymfony-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Fsymfony-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Fsymfony-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/planetscale","download_url":"https://codeload.github.com/planetscale/symfony-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Fsymfony-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33637485,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-24T10:29:45.670Z","updated_at":"2026-05-29T04:31:11.336Z","avatar_url":"https://github.com/planetscale.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Learn how to integrate PlanetScale with a sample Symfony application\n\n\u003e **Note:** This tutorial targets PlanetScale Vitess/MySQL. PlanetScale also offers managed Postgres. For more information, see the [PlanetScale Postgres documentation](https://planetscale.com/docs/postgres).\n\nThis sample application demonstrates how to connect to a PlanetScale MySQL database, create and run migrations, seed the database, and display the data.\n\nFor the full tutorial, see the [Symfony PlanetScale documentation](https://planetscale.com/docs/tutorials/connect-symfony-app).\n\n## Set up the Symfony app\n\n1. Clone the starter Symfony application:\n\n```bash\ngit clone git@github.com:planetscale/symfony-example.git\n```\n\n2. Navigate into the folder and install the dependencies:\n\n```bash\ncd symfony-example\ncomposer install\n```\n\n3. Copy the `.env` file into `.env.local`:\n\n```bash\ncp .env .env.local\n```\n\n4. Start the application:\n\n```bash\nsymfony serve\n```\n\nView the application at [http://localhost:8000](http://localhost:8000).\n\n\n## Set up the database\n\n1. Authenticate the CLI with the following command:\n\n```bash\npscale auth login\n```\n\n2. Create a new database with a default `main` branch with the following command:\n\n```bash\npscale database create \u003cDATABASE_NAME\u003e --region \u003cREGION_SLUG\u003e\n```\n\nThis tutorial uses `symfony_example` for `DATABASE_NAME`, but you can use any name with lowercase, alphanumeric characters, or underscores. You can also uses dashes, but we don't recommend them, as they may need to be escaped in some instances.\n\nFor `REGION_SLUG`, choose a region closest to you from the [available regions](/concepts/regions#available-regions) or leave it blank.\n\n## Connect to the Symfony app\n\nThere are **two ways to connect** to PlanetScale:\n\n- Using client certificates with the CLI\n- With an auto-generated username and password\n\nBoth options are covered below.\n\n### Connect with username and password\n\n1. Create a username and password with the PlanetScale CLI by running:\n\n```bash\npscale password create \u003cDATABASE_NAME\u003e \u003cBRANCH_NAME\u003e \u003cPASSWORD_NAME\u003e\n```\n\n\u003e Note: `PASSWORD_NAME` represents the name of the username and password being generated.\n\nTake note of the values returned to you, as you won't be able to see them again.\n\n2. Open the `.env.local` file in your Symfony app, find the database connection string shown below and replace it with:\n\n```\nDATABASE_URL=\"mysql://\u003cUSERNAME\u003e:\u003cPASSWORD\u003e@\u003cACCESS_HOST_URL\u003e:3306/\u003cDATABASE_NAME\u003e?serverVersion=8.0\"\n```\nDon't forget to replace the placeholders `\u003cUSERNAME\u003e`, `\u003cPASSWORD\u003e`, `\u003cACCESS HOST URL\u003e` and `\u003cDATABASE_NAME\u003e` with the appropriate values from the output above.\n\n### Connect with client certificates\n\nTo connect with client certificates, you'll need the [PlanetScale CLI](https://github.com/planetscale/cli).\n\n1. Open a connection by running the following:\n\n```bash\npscale connect \u003cDATABASE_NAME\u003e \u003cBRANCH_NAME\u003e\n```\n\nThe default branch is `main`.\n\n2. A secure connection to your database will be established, and you'll see a local address you can use to connect to your application.\n\n3. Open the `.env.local` file in your Symfony app and update it as follows:\n\n```\nDB_HOST=127.0.0.1\nDB_PORT=3306\nDB_NAME=\nDATABASE_URL=${DB_HOST}:${DB_PORT}/${DB_NAME}?serverVersion=8.0\n```\n\nThe connection uses port `3306` by default, but if that's being used, it will pick a random port. Make sure you paste in whatever port is returned in the terminal. You can leave `DB_USERNAME` and `DB_PASSWORD` blank.\n\nRefresh your Symfony homepage and you should see the message that you're connected to your database!\n\n## Run migrations and seeder\n\n1. Make sure your database connection has been established. You'll see the message \"You are connected to your-database-name\" on the [Symfony app homepage](http://localhost:8000/) if everything is configured properly.\n\n2. In the root of the Symfony project, run the following to run migrations:\n\n```bash\nsymfony console doctrine:migrations:migrate\n```\n\nYou will get a message to confirm your action, just type \"yes\" and hit enter to proceed.\n\n3. Seed the database by running:\n\n```bash\nsymfony console doctrine:fixtures:load\n```\n\nThis will purge your database and load the random data into it.\n\n4. Refresh your Symfony homepage, and you'll see a list of Ecommerce products and their category printed out.\n\n## Need help?\n\nIf you need further assistance, you can reach out to [PlanetScale's support team](https://www.planetscale.com/support), or join our [GitHub Discussion board](https://github.com/planetscale/beta/discussions) to see how others are using PlanetScale.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplanetscale%2Fsymfony-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplanetscale%2Fsymfony-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplanetscale%2Fsymfony-example/lists"}