symfony flex composer InvalidArgumentException - php

So I downloaded symfony 4 with help of this command
composer create-project symfony/skeleton my-project
Afterwards, from the project's directory I try to pull the symfony's flex profiler package using command
composer require profiler --dev
but composer is having issue. Like it wants to pull the package down the standard way and not by utilizing symfony flex
UPDATE: Issued at https://github.com/symfony/flex/issues/306

see the answer of nicolas-grekas in the following link
you can continue using the symfony containers in this link, just look for the alias that flex used.
in your case twig for flex is "symfony / twig-bundle", run composer req symfony / twig-bundle.
salu2

Related

How do I run symfony console?

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

How to create composer package that can create skeleton files via composer create-project

I am thinking to create a project skeleton in the following format via a composer package that I am going to create.
/app
/config
/web
/vendors
Just wondering about this command
composer create-project vendor/name path
--repository-url=http://repo.yourcomposerrepo.com
What do I need to put in the composer.json in order to create the file structure I want? Is it done through the shell script or it just copied the files from the repositories?
For symfony it will create the files and folders automatically through composer create-project. Just wondering how do I achieve the similar thing for this case. When I looked at their repo it only contains one composer.json at https://github.com/symfony/skeleton
composer create-project symfony/skeleton blog
Thank you.
composer create-project will create a new directory with all the files that are part of that package and then it will run the installation for all the dependencies that are listed in that package's composer.json file.
If you want to have a better example to understand that, you can use the old way that we used to bootstrap Symfony applications (when not using the Symfony installer). Then applications were based on the Symfony Standard Edition which you can find on GitHub. Just run composer create-project symfony/framework-standard-edition and compare the result with the repository.
Using symfony/skeleton as the base package is a bit special. This package depends on Symfony Flex which is a Composer plugin that automatically applies so called recipes (see https://flex.symfony.com/) which will lead to newly created files when a package is installed (and clean them up on removal). But, this behaviour is special for Flex and thus nowadays Symfony 4 based application and not a good example for what composer create-project does by default.

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

Testing Symfony flex on Windows

I can't make composer working with flex receipe on a symfony4 project, on Windows.
Here is the complete process :
I installed PHP7.2 from http://windows.php.net/download#php-7.2 (VC15 x86 Non Thread Safe), PATH env is set. php.ini is created (from php.ini-development). PHP is working on windows (php -v).
I installed composer from the Composer-Setup.exe (https://getcomposer.org/download/). It changed the php.ini for me for activating some php extensions (openssl, etc).
I created a project with composer create-project symfony/skeleton sf4
I moved to sf4 dir : cd C:/sf4
I run Web Server : php -S 127.0.0.1:8000 -t public
It works when I browse locahost:8000
So I want to install the symfony twig bundle as a flex package : composer require twig
The error I get :
[InvalidArgumentException]
Could not find package twig.
Did you mean one of these?
twig/twig
slim/twig-view
latte/latte
twig/extensions
timber/timber
I tried with a local composer.phar inside the sf4 project :
cd C:/sf4
php composer.phar require twig
=> same error
Composer seems to ignore flex plugin, do you have any idea ? Thx !
see the answer of nicolas-grekas in the following link
you can continue using the symfony containers in this link, just look for the alias that flex used.
in your case twig for flex is "symfony / twig-bundle", run composer req symfony / twig-bundle.
salu2

How to integrate ACL in Symfony 3.0?

I am new in symfony 3.0. I want to integrate ACL in my project.I am using following environment.
Symfony 3.0
OS: Windows
I did follow below link:
http://symfony.com/doc/current/cookbook/security/acl.html
When I run this command: php bin/console init:acl
I am getting following message:
[LogicException]
You must install symfony/security-acl in order to use the ACL functionality
Can anyone suggest how I can integrate it? Is there any demo URL and from where I can download the code?
You are missing a package that Symfony needs in order to activate ACL on your project.
To install such packages, you'll need to have a working Composer installation (Composer is a PHP dependency management scripts you can use to manage packages): see https://getcomposer.org/download/
Once Composer is running, you can open a console and go to the root of your project. There you can run the following command line option:
composer require symfony/security-acl
followed by:
composer update
Now you should be able to run the php bin/console init:acl command successfully.

Categories