Here's my problem :
When I try to create a symfony project with 'composer create-project symfony/skeleton project-name' (or website-skeleton) I got this error telling me I don't have .env-file
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!!
!! Fatal error: Uncaught Symfony\Component\Dotenv\Exception\PathException: Unable to read the "C:\Users\Us\Desktop\Projects\newEra\newera-back/.env" environment file. in C:\Users\Us\Desktop\Projects\newEra\newera-back\vendor\symfony\dotenv\Dotenv.php:567
!! Stack trace:
!! #0 C:\Users\Us\Desktop\Projects\newEra\newera-back\vendor\symfony\dotenv\Dotenv.php(114): Symfony\Component\Dotenv\Dotenv->doLoad(false, Array)
!! #1 C:\Users\Us\Desktop\Projects\newEra\newera-back\vendor\symfony\dotenv\Dotenv.php(157): Symfony\Component\Dotenv\Dotenv->loadEnv('C:\\Users\\Us\\...', 'APP_ENV', 'dev', Array, false)
!! #2 C:\Users\Us\Desktop\Projects\newEra\newera-back\vendor\symfony\runtime\SymfonyRuntime.php(107): Symfony\Component\Dotenv\Dotenv->bootEnv('C:\\Users\\Us\\...', 'dev', Array, false)
!! #3 C:\Users\Us\Desktop\Projects\newEra\newera-back\vendor\autoload_runtime.php(23): Symfony\Component\Runtime\SymfonyRuntime->__construct(Array)
!! #4 C:\Users\Us\Desktop\Projects\newEra\newera-back\bin\console(11): require_once('C:\\Users\\Us in C:\Users\Us\Desktop\Projects\newEra\newera-back\vendor\symfony\dotenv\Dotenv.php on line 567
!!
Script @auto-scripts was called via post-update-cmd
But with symfony/symfony-demo the cache:clear works
Generating autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
Run composer recipes at any time to see the status of your Symfony recipes.
Executing script cache:clear [OK]
Executing script assets:install public [OK]
PHP version
PHP 7.4.30 (cli) (built: Jun 7 2022 18:05:59) ( ZTS Visual C++ 2017 x86 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
Composer version
Composer version 1.8.0 2018-12-03 10:31:16
What could be the problem ?
Edit 1 : after going to php 8.1
Problem 1
- symfony/flex v2.2.2 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.2.1 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.2.0 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.1.8 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.1.7 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.1.6 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.1.5 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.1.4 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.1.3 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.1.2 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.1.1 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.1.0 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.0.1 requires composer-plugin-api ^2.1 -> no matching package found.
- symfony/flex v2.0.0 requires composer-plugin-api ^2.1 -> no matching package found.
- Installation request for symfony/flex ^2 -> satisfiable by symfony/flex[v2.0.0, v2.0.1, v2.1.0, v2.1.1, v2.1.2, v2.1.3, v2.1.4, v2.1.5, v2.1.6, v2.1.7, v2.1.8, v2.2.0, v2.2.1, v2.2.2].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
- It's a private package and you forgot to add a custom repository to find it
I follow the tuto on getcomposer.org but when I do this command :
curl -sS https://getcomposer.org/installer | php -- --check
I get
All settings correct for using Composer
My Answer:
Symfony/skeleton is a lightweight Symfony application that serves as a starting point for building Symfony applications. It provides a basic structure and configuration for a Symfony project, allowing developers to quickly get started with building their application.
To create a new Symfony project using the Symfony/skeleton, you can use Composer to create a new project and require the Symfony/skeleton package. Here's how you can do it:
1. Install Composer if you haven't already: https://getcomposer.org/download/
2. Create a new Symfony project using the Symfony/skeleton package:
composer create-project symfony/skeleton my_project_name
3. Change into the newly created project directory:
cd my_project_name
4. Start the Symfony development server:
php bin/console server:run
You can now access your Symfony application in your web browser at http://localhost:8000.
From here, you can start building your Symfony application by creating controllers, routes, templates, and more. The Symfony/skeleton provides a solid foundation for building Symfony applications and allows you to easily customize and extend it to fit your project's needs.
Rate this post
4 of 5 based on 4898 votesComments