How to install WhiteOctoberPagerfantaBundle on Symfony 2.0.x - symfony

So far, the bundles I've used for Symfony2 has been installed modifying the deps file and then running the command bin/vendors install, but for this bundle (WhiteOctoberPagerfantaBundle) the installation process is made using git submodule add command which I don't fully understand.
git submodule add http://github.com/whiteoctober/Pagerfanta.git vendor/pagerfanta
git submodule add http://github.com/whiteoctober/WhiteOctoberPagerfantaBundle.git vendor/bundles/WhiteOctober/PagerfantaBundle
I assume that this command retrieves the master version of both libraries, but the documentation says that if I'm using Symfony 2.0.x (which is my case) I should get the symfony2.0 branch:
"Note: If you are using a 2.0.x release of Symfony2, please use the symfony2.0 branch of this bundle. The master branch of this bundle tracks the Symfony2 master branch."
How should I modify the git commands to get the symfony2.0 branch instead of the master? Why some bundles are installed using the deps files while others uses git submodules? What is the difference?

You can still use bin/vendors and the deps system to install these bundles/vendors
in deps
[Pagerfanta]
git=http://github.com/whiteoctober/Pagerfanta.git
target=/pagerfanta
[WhiteOctoberPagerfantaBundle]
git=http://github.com/whiteoctober/WhiteOctoberPagerfantaBundle.git
target=/bundles/WhiteOctober/PagerfantaBundle
version=origin/symfony2.0
And re-run bin/vendors install

Related

Can't create a new Symfony project

I can't create a new Symfony project as described in the Symfony Documentation: https://symfony.com/doc/4.3/setup.html
This is the command I use: symfony new --full my_project
Output:
$ symfony new --full my_project
WARNING The current directory seems configured for as a SymfonyCloud project, but it is not linked yet.
You can link this directory to an existing project: symfony link [project-id] (get project IDs via symfony projects)
* Creating a new Symfony project with Composer
unable to find composer, get it at https://getcomposer.org/download/: exec: "composer": executable file not found in
$PATH
I don't understand why the command can't find the composer executable.
When I just enter $ composer in my terminal, composer is executed.
This is my Symfony CLI version: Symfony CLI version v4.6.1
In my .bash_profile file, I have an alias for composer:
alias composer="php /usr/local/bin/composer.phar"
My /etc/paths:
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
What is wrong in my config?
Most likely, it's because you didn't rename composer.phar.
First, do this:
mv /usr/local/bin/composer.phar /usr/local/bin/composer
It will rename composer.phar to composer.
Then you can also delete your alias.
Alias are for connected users. Executable and installer don't read your aliases, which is why symfony installer isn't finding composer.
If it doesn't solve your problem, you can try to install your Symfony project with composer directly:
composer create-project symfony/website-skeleton my_project
You can also check what php version is that your symfony is using
In my case it was linked to php 5 and by changing to php 7 problem has been resolved
To check php version linked use :
symfony local:php:list
And then to edit your php version create a .php-version file then write the version that you want to use

Why composer updates all existent deps?

I added a new bundle dependency to my composer.json file and when running composer update command, the composer updates all existent deps while I just want to install the new bundle.
Is there a command option to install just the new deps without updating existent ones ?
Is there a command option to install just the new deps without updating existant ones?
Yes, there is: composer require.
Simply run composer require vendor/package.
From the docs
In order to get the latest versions of the dependencies and to update the composer.lock file, you should use the update command.
php composer.phar update
This will resolve all dependencies of the project and write the exact versions into composer.lock.
If you just want to update a few packages and not all, you can list them as such:
php composer.phar update vendor/package vendor/package2
You can also use wildcards to update a bunch of packages at once:
php composer.phar update vendor/*

Not a git repository error when updating via Composer

I'm trying to update my Symfony 2 project from 2.1.4 to 2.1.7 using composer and run php composer.phar update as normal, after updating a few dependencies I receive the following error:
[RuntimeException]
Failed to clone http://github.com/fabpot/Twig-extensions via git, https
and http protocols, aborting.
- git://github.com/fabpot/Twig-extensions
fatal: Not a git repository (or any of the parent directories): .git
- https://github.com/fabpot/Twig-extensions
fatal: Not a git repository (or any of the parent directories): .git
- http://github.com/fabpot/Twig-extensions
fatal: Not a git repository (or any of the parent directories): .git
I've checked the URL and can confirm that it exists, I'm also able to git clone it without any issues from the same CLI.
What's odd is if I run php composer.phar update twig/extensions separately it seems to update without a problem.
This typically happens if you have an old symfony copy that shipped with the vendors installed as git repos but with the git repos removed. To fix it you should just remove the vendor directory so they will reinstall from scratch as git clones or as zip archives, but without any previous assumptions.
Note that currently, I experience a similar issue while using composer with hhvm and PHP 7.
[RuntimeException]
Failed to execute git checkout 'hash' -- && git reset --hard 'hash' --
fatal: Not a git repository (or any of the parent directories): .git
The error appears depending on the composer.json not always but rather regularly. I switch off hhvm to get it working.

Where to run `$ php vendors install` from?

I am new to Symfony, and there are many command lines need to be run, but I did not know where to run those commands.
In the directory where you installed Symfony. There shold be some subdirectories: app, src, bin, vendors... And the command you should run is php bin/vendors install.
Notice that this command is for Symfony 2.0.x. If you installed the latest symfony version (2.1.x) you should not use this command and use Composer instead.

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