How do I run symfony console? - php

Everywhere I look in the Symfony documentation for Symfony 4.2, it says that to clear the cache, I run:
php bin/console cache:clear
However, this bin/console is a relative path. I can't find bin/console anywhere. I've done a find on my composer vendor directory. Nothing.
Where is bin/console?
I'm running php 7.2.

Symfony 4.x structures in like this (From CoderSkills)
If you don't have the same after your installation, remove your project folder and create a new ones by running composer create-project symfony/website-skeleton myNewProject
Here is a guide to start a new Symfony project

Related

Issues using php artisan on a laravel 5.7.* app

I've been trying to work on a laravel app but I can't even make it start.
I've run composer install, composer global update, composer udpate, composer self-update and several other commands,
I've deleted the vendor folder, the composer.lock file, re-ran composer install and things I've found online to no avail. This is the error I keep getting:
#php artisan package:discover
In Container.php line 779:
Class request does not exist
Script #php artisan package:discover handling the post-autoload-dump event returned with error code 1
Not sure where to go next. Any ideas?
I would suggest you remove your composer itself and re-install the composer. the try install you laravel packages with it.
Try clearing application cache using this command: php artisan cache:clear
The cache:clear command can be used to clear the applications cache files.
Don't worry about your laravel
check composer correctly installed on your system
check composer have access for READ and WRITE in your system
after your sure about things
check your laravel install in your system for PHP you have and find specific you php version composer connected to it (Those who have multi PHP)
then have two option:
composer global require laravel/installer
then laravel new blog or
composer create-project --prefer-dist laravel/laravel blog
then go to folder cd /projectName
Use PHP's built-in development server: php artisan serve

Symfony 4 - No route found after installation on Mac

I have tried to install the Symfony 4 on my Macbook Air by using Composer. I have used the below commands for installing and running Symfony application
composer create-project symfony/website-skeleton symfony4
cd symfony4
composer require server --dev
php bin/console server:run
And then tried to access the application in http://127.0.0.1:8000/. Below is the error message
Below image shows the error in which line and file
I am using PHP 7.2.3 and installed by using Homebrew. At the same time when I use the below command to install, Symfony welcome page appears without any error.
composer create-project symfony/skeleton symfony4
There is no default welcome page when you create new symfony flex application and there is an issue and a pull request already.
Everything is working fine you just don't have any pages.
Here you can read how to create a symfony page: https://symfony.com/doc/current/page_creation.html

Can't run php bin/console in symfony

I'm new on symfony, after following instruction to install it, it said i have to run:
bin/console server:run
i type it on my symfony instalation folder. but i got error:
Could not open input file: bin/console
and then i'm searching the answer in here and it told me to run app/console
bin/console server:run
but it just got the same problem. is it i miss some bin folder here or something? since i can't see bin folder or app folder on my project root folder. here's my project folder structure:
You obviously cloned a Git repo, which does not contain all Symfony framework components.
You have to create symfony project through
symfony installer http://symfony.com/doc/current/setup.html
or
with composer composer create-project symfony/framework-standard-edition my_project_name.

create symfony project using the symfony installer

i used to to use composer to create a new symfony project like so
composer create-project symfony/symfony-standard-edition SymfonyProjectDir 2.5.*
but know when i want to use the symfony installer i use the command
symfony new SymfonyProjectDir 2.5.*
or
symfony new SymfonyProjectDir 2.5
but i get this error
[RuntimeException]
The Symfony version should be 2.N.M, where N = 0..9 and M = 0..99
new directory [version]
how can i tel that i want to use the version 2.5 including the last updates from symfony like i used to with composer?
There is no reason to have the latest minor version of an version. You start developing with the latest version and then you should freeze it until there is a reason to update.
If you don't care, clone the git repo, grep your tag and create your project with it.
You can try this, it worked for me:
Symfony Installation and Project Creation
Or just open command line and execute these commands:
for (linux/mac)
sudo curl -LsS http://symfony.com/installer -o /usr/local/bin/symfony
sudo chmod a+x /usr/local/bin/symfony
symfony new SymfonyProjectDir 2.5
The version will be the most recent version in 2.5, as you want
Last answer here is from 2016 so if you end up here somehow in 2019 the solution is much easier!
First make sure you are using a php version of 7.1 or higher.
Check if you have composer installed and if you don't just follow this easy documentation: Download/Install Composer
Now you are all set, go to the directory where you want your symfony project be stored and enter the command composer create-project symfony/website-skeleton my-project. This will create your first structure in symfony 4!
Now you just enter your project directory and type php bin/console server:run on your terminal and you are done.
You can import repositories from git too starting git init from the same project folder.
First time with Symfony? Follow this tutorial for a first controller/view: Introduction to symfony4
Hope this if somehow usefull to anyone, i'm just trying to give something back to this community that has given me so much.
Please try with it:
composer create-project symfony/framework-standard-edition SymfonyProjectDir/ 3.0.7
It should work. Maybe your forgot the last slash...

bin/console missing after running composer install

Hoping someone could help me out with this one please.
My project (on github https://github.com/irvingswiftj/iceMarkt ) when running composer install, seems to run without a hitch, until running the post update commands. In which I end up with the following error (when adding param -vvv):
Updating the "app/config/parameters.yml" file
Could not open input file: bin/console
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
If I now browse my project directory, I can see that bin/console is never created!
I had deleted the bin directory assuming that the executable console file would be created in my next composer install. I was wrong! Don't gitignore your bin/composer file and also make sure that if you are using the symfony 3 folder structure, you don't have .gitignore for the symfony 2 folder structure.
I had the same problem because I was accostumed to add the bin directory to my .gitignore file, because in Symfony2 all bin files (including the ones from other vendors) where placed in that folder, but that is not the case in Symfony3, so we can add the bin directory to our code repositories.
You can solve problem installing a new application (using the symfony installer) and copying the bin directory from this new project to your own project.
Using Symfony 4 / Symfony Flex, you need to install the symfony/console package:
composer require symfony/console
Then use from your project dir:
./bin/console
As the file itself is starting with a shebang #!/usr/bin/env php you can execute it right away without php infront.
With newer versions of Symfony and Flex installed,
composer --force recipes:install symfony/console
This will bring bin/console into existence.
If it's already there but you need to update it, use
composer recipes:update symfony/console
composer recipes
Just lists your recipes.

Categories