xxxxxxxxxx
$ symfony new my_project_directory --version="7.0.*" --webapp
# run this if you are building a microservice, console application or API
$ symfony new my_project_directory --version="7.0.*"
xxxxxxxxxx
requirements:
- php 8.1 or higher
- composer (https://getcomposer.org/download/)
then use these commands:
mac/linux (using brew):
brew install symfony-cli/tap/symfony-cli
windows:
choco install symfony-cli
OR
scoop install symfony-cli
xxxxxxxxxx
//Open PowerShell
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
iwr -useb get.scoop.sh | iex
scoop install symfony-cli
//If you are building a traditional web application:
symfony new --webapp my_project
//If you are building a microservice, console application or API:
symfony new my_project
xxxxxxxxxx
# Step 1: Install Symfony CLI
wget https://get.symfony.com/cli/installer -O - | bash
mv ~/.symfony/bin/symfony /usr/local/bin/symfony
# Step 2: Check Symfony CLI version
symfony version
# Step 3: Create a new Symfony project
symfony new my_project_name --full
# Step 4: Change into the project directory
cd my_project_name
# Step 5: Run the Symfony development server
symfony serve
# You can now access your Symfony application at http://localhost:8000
xxxxxxxxxx
curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.deb.sh' | sudo -E bash
$ sudo apt install symfony-cli
xxxxxxxxxx
composer create-project symfony/skeleton S6
cd S6
runsite && dbash
composer require webapp
xxxxxxxxxx
<?php
// src/Controller/LuckyController.php
namespace App\Controller;
use Symfony\Component\HttpFoundation\Response;
class LuckyController
{
public function number(): Response
{
$number = random_int(0, 100);
return new Response(
'<html><body>Lucky number: '.$number.'</body></html>'
);
}
}