symfony 2 composer line command - symfony

I have little problem with updating bundle in symfony 2
I installed composer to do it but composer seems doesn't work correctly. No matter what I put in command line, composer shows version, available commands and that's all. Nothing more. Doing nothing. Did somebody have similar problem?
Jacob

What SO do you use? If you use Windows try open cmd and type this:
composer
this command shows you information about Composer, if it does not, you need add the route in the Environment Variables (Variable: Path).

Related

How to run symfony cli command with --webapp using local composer.phar?

I run different versions of Symfony and PHP on my Mac for various apps I have to work on (sorry that our clients are so slow to get to upgrade), and I'm trying to install the LTS version of Symfony through the CLI documentation recommendations, but I'm trying to get it to use a composer.phar in the folder I run the command in... it keeps defaulting to the globally-installed one.
Sure I could just go change composer's execution path or upgrade/downgrade it temporarily whenever I want to run the cli for x version of PHP, but that's gonna drive me crazy and I'd rather see how to tell it to run a certain composer.phar file. I'm not seeing in the documentation how to do this to get the benefits of the --webapp option.
The documentation is weird on it anyway; I can't tell if running composer directly (as composer.phar) will give me the benefits of the --webapp option using the symfony command (because the composer commands are identical for 'traditional web application' and 'console application or API'):
https://symfony.com/doc/5.4/setup.html#creating-symfony-applications
# run this if you are building a traditional web application
$ symfony new my_project_directory --version=5.4 --webapp
# run this if you are building a microservice, console application or API
$ symfony new my_project_directory --version=5.4
# run this if you are building a traditional web application
$ composer create-project symfony/skeleton:"^5.4" my_project_directory
$ cd my_project_directory
$ composer require webapp
# run this if you are building a microservice, console application or API
$ composer create-project symfony/skeleton:"^5.4" my_project_directory
When I run the install through composer directly, I can't tell if I'm getting the benefits of the symfony command --webapp option... and I'm not seeing an option for the symfony command to specify to use the folder's composer.phar.
I had to cheat a little bit: I installed the latest composer using the instructions here to a composer.phar file:
https://getcomposer.org/download/
I then created a console alias like php composer.phar, ran the Symfony create composer command with that alias, which created the symfony-5 folder no problem, then I copied the composer.phar file to the new folder and run the alias for any other composer commands, like with require webapp, which is working! Kind of nice to freeze a version of composer for any similar repos.
Maybe not the best answer, but it's working.
Also I discovered that I could just run composer self-update to get the latest version, which worked, then composer self-update [whatever version number] to get back to one I need that works with other repos (since certain version ranges just do not work with certain version ranges of PHP). Annoying, but functional.
Ultimately I think moving forward, it's best to make a copy of composer.phar at a compatible version range for your older PHP apps, depending on their versions, and use those in an alias, rather than totally rely on a global composer version, which has proven not completely workable for my work.

Failed to parse command output (Symfony)

So this is what I got when I try to add the Symfony tool (Symfony version : 3..)
The project was created from another machine and cloned into mine (Git)
I could make the necessary changes for composer.phar and php.exe when adding the Composer tool and I had no problem concerning that but when it comes to add the Symfony tool I got a " Failed to parse command output " error message and there are the details of the error
enter image description here
What should I do?
Thank you
As you can see, yours paths contain both "/" and "\". I think this happened because you create the project in a linux/unix machine and now you are working on Windows.
Path problem is in composer files. Is vendor folder committed in the repository? If yes, remove it and re run composer install.

Running PHPUnit test in PhpStorm adds "--teamcity" option causing error

I have the latest PhpStorm (2016.2) and PHPUnit phar (5.5.4). For some reason when I run a PHPUnit test in my project in PhpStorm, it is adding on --teamcity to the run command, resulting in a failure:
Testing started at 12:52 PM ...
Unit test suite invoked with a path to a non-unit test: --teamcity
Process finished with exit code 1
I have no idea where this --teamcity option is coming from, it happens no matter what test I run, and even when starting from a blank configuration. I also do NOT have the TeamCity plugin installed, I don't even use TeamCity.
Here's what the full command appears as:
/usr/local/Cellar/php70/7.0.9/bin/php /Users/name/bin/phpunit-5.5.4.phar --configuration /path/to/config/my-phpunit.xml ClassNameTest /Users/name/PhpstormProjects/path/to/tests/unit/app/ClassNameTest.php --teamcity
(sensitive information swapped out)
All I want to do is get rid of this --teamcity option, everything works if I run in a separate terminal window without that option. This only recently started happening, maybe after a PhpStorm update.
tl;dr
I only could resolve this by removing the system installed phpunit instance from my system (Linux):
sudo apt remove phpunit-*
Details
Even if the setting in PhpStorm was to use composer autoloader:
for some reason it ended up using TeamCity from /usr/share/php/PHPUnit/Util/Log/TeamCity.php:
Project's local PHPUnit was 6.2 while the system default was 5.1 -> they're incompatible.
I spent half a day struggling with this. The underlying issue is switching between PHPUnit versions (6.x.x -> 4.x.x). (Happened to me by switching branches)
A click on the refresh button in the PHPUnit preferences fixes it.
(Languages & Frameworks > PHP > PHPUnit)
Make sure the version of PHPUnit it thinks you have matches the one it reports.
This --teamcity option is used by PHPStorm to output tests result.
What you're facing is an issue caused by PHP7 and an old version of PHPUnit.
Remove your PHPUnit 5 and install the latest one (currently 6.2) with composer and use PHPUnit namespaces instead.
More info on this bug: https://github.com/sebastianbergmann/phpunit/issues/2460
Problem was internal to the project. PHPUnit does not contain that error message. Sorry!

symfony plugin install namespace error

I created a new symfony 2 project using 2.7. When I try to install a plugin using command line "symfony plugin:install sfFormExtraPlugin", I got an error:
"[InvalidArgumentException]
There are no commands defined in the "plugin" namespace.".
When I type "symfony list", I got "
Available commands:
about Symfony Installer Help.
demo Creates a demo Symfony project.
help Displays help for a command
list Lists commands
new Creates a new Symfony project.
self-update Update the installer to the latest version.
selfupdate Update the installer to the latest version.
". no plugin or other command like "cache" etc. What should I do? Thanks!
sfFormExtraPlugin is a plugin for Symfony 1 and won’t work with Symfony 2.*
Also, the symfony command line tool in Symfony 2 is not meant for application commands anymore but for creating new projects/installing Symfony. The new command line tool for application commands is app/console (which you use like php app/console something:something.)
But even then, this command isn’t used for managing dependencies (like plugins) anymore. We use composer for that instead. That’s a powerful package manager for PHP that can install and update the packages you require and also make sure that they are compatible. And it is not limited to the Symfony world.

Symfony 2.0 bundle installation

So I am a new to doctrine, but I am not able to install a bundle at all. I am following the guide, but the "error" which I am getting is very unusual.
Anyhow, I add this lines into deps file:
[FOSRestBundle]
git=http://github.com/FriendsOfSymfony/FOSRestBundle.git
target=bundles/FOS/RestBundle
Then I do:
./bin/vendors install
And I get:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/sqlite.so' - /usr/lib/php5/20090626+lfs/sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0
Your project seems to be based on a Standard Edition that includes vendors.
Try to run ./bin/vendors install --reinstall
So on this standard way I am not able to install it at all. Can somebody explain me what is the problem, because to me it looks like, the symfony vendors script doesnt recognize changes in deps file at all.
This happens when you've downloaded the Symfony2 Standard Edition from the website. The vendor install script checks to see if the vendor directories are git repositories, and if not, will throw this error. You can fix the situation in one of two ways:
you can either run the command that it suggests: php bin/vendors install --reinstall
or, you can remove the vendors directory, then run php bin/vendors install, which amounts to about the same thing
No need to install that. Just follow the steps in the url : http://mmoreramerino.github.com/GearmanBundle/installation.html

Resources