Where to install Composer and Symfony - php

I am using Symfony2 on my MacBook in local. So I have Symfony2 installed, MAMP installed and composer installed. But not sure if I installed them where I should install it. Would be very nice to have an overall files and folder plans to do it properly.
Here where I install Symfony and where I have composer:
My symfony2 is here:
Applications/MAMP/htdocs/Symfony/
this file: composer.json is in Symfony
Applications/MAMP/htdocs/Symfony/composer.json
And composer.phar and again composer.json is in here:
username/MyWebSite/bin/composer/composer.phar
-------------------------------/path/composer.json
(where should I put my symfony file and my composer files? What should I change (configuration) so that my website still working on localhost if I change something?

Try to put composer.json and composer.phar at the root of your Symfony folder (Applications/MAMP/htdocs/Symfony/).
Then "php composer.phar update" in the Command Line Interface.

Related

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

Creating a cakephp project using composer and setting the path

I have Composer installed globally, So I open CMD and write the following command to create a project (composer create-project --prefer-dist cakephp/app my_app_name). What this does is install the project in my user folder. I need the project to be installed in wamp/www folder. And I can't for the life of me figure out how to set the path. Should I just cut-paste the project there or will that create issues with cakephp? still new to the framework :)
Any help would be appreciated. Thanks.
Installing CakePHP
Before starting you should make sure that you have got an up to date PHP version:
php -v
You should at least have got installed PHP 5.5.9 (CLI) or higher. Your webserver’s PHP version must also be of 5.5.9 or higher, and should best be the same version your command line interface (CLI) PHP version is of.
Installing Composer
CakePHP uses Composer, a dependency management tool, as the officially supported method for installation.
Installing Composer on Linux and Mac OS X
Run the installer script as described in the official Composer documentation and follow the instructions to install Composer.
Execute the following command to move the composer.phar to a directory that is in your path:
mv composer.phar /usr/local/bin/composer
Installing Composer on Windows
For Windows systems, you can download Composer’s Windows installer here. Further instructions for Composer’s Windows installer can be found within the README here.
Create a CakePHP Project
Now that you’ve downloaded and installed Composer, let’s say you want to create a new CakePHP application into my_app_name folder. For this just run the following composer command:
php composer.phar create-project --prefer-dist cakephp/app my_app_name
Or if Composer is installed globally:
composer self-update && composer create-project --prefer-dist cakephp/app my_app_name
Once Composer finishes downloading the application skeleton and the core CakePHP library, you should have a functioning CakePHP application installed via Composer. Be sure to keep the composer.json and composer.lock files with the rest of your source code.
First point your composer to www folder.In my case i am using Xamp so pointed my composer to htdocs
C:\xampp\htdocs>composer create-project --prefer-dist cakephp/app my_app_name
Installing cakephp/app (3.3.2)
- Installing cakephp/app (3.3.2)
Downloading: 100%
Created project in my_app_name
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Updated
I am using windows .
C:\Users\Vision>cd\
C:\>cd xampp
C:\xampp>cd htdocs
C:\xampp\htdocs>
Also in windows if i right click on inside htdocs any folder i have option to use composer here

Yii2 installing extensions

Hi,
I have just installed a Yii2 basic project from composer. I'm in mac osx yosemite 10.10.
Neverthless i'm trying to install extensions as descrived in the tutorials from Yii guide 2.0 and i cannot do it, simply to the fact that i don´t know where to put the line:
php composer.phar require --prefer-dist arturoliveira/yii2-tileslidemenu "*"
this method says in terminal it cannot find composer.phar.
Where to put the above line ?
When i installed the project "acastro" i wrote in terminal the line:
composer create-project --prefer-dist yiisoft/yii2-app-basic acastro
and the installation worked very well (i had to deal with the mcrypt missing error first but then composer was recognized as a command by termnal)
So, what is the issue here, since nothing installs in vendors dir?
I have tried the other method but nothng happens. The method was:
"arturoliveira/yii2-tileslidemenu": "*"
added in the required section of composr.json file.
When i launch the project by localhost MAMP, nothing is installed in vendors dir.
Anyone can explain me how to install the proper way an extension in Yii2. In Yii1.1 was so easy to do it.
Many thanks in advance.
So if you have global installation of composer and you do composer create-project --prefer-dist yiisoft/yii2-app-basic acastro, than you can do same with that line too:
composer require --prefer-dist arturoliveira/yii2-tileslidemenu "*"
I don't use MAMP, only XAMPP, but as far as I know, you have to manually do composer actions via command line.

Installing Laravel

I am on a windows 8 machine and I'm trying to learn laravel. I copy and pasted my PHP folder from C:\xampp to C:\php, installed composer, ran composer install then composer create-project laravel/laravel learning-laravel. So far everything was created so I went into the directory and tried to use 'php artisan serve' and got the following error.
C:\Users\denni_000\learning-laravel>php artisan serve
Warning: require(C:\Users\denni_000\learning-laravel\bootstrap/../vendor/autoloa
d.php): failed to open stream: No such file or directory in C:\Users\denni_000\l
earning-laravel\bootstrap\autoload.php on line 17
Why you copied php folder
download composer install it.
download laravel latest version and store it on your xampp/htdocs/laravel
and run cmd with composer install command
For more follow install laravel on windows xampp
or Laravel 4.1 installation with composer in xampp
For windows Simply download Laragon which includes latest php 5.6.7, Apache, Mysql, Redis, Memcached an alternative to Xampp or Mamp with small size. Easy to install laravel and create project with auto create virtual host by it. Thank you.
U need to go to the directory where laravel is installed and run the following command.
composer update
Install Laravel 4.2 with composer:
sudo composer.phar create-project laravel/laravel project-directory-name 4.2 --prefer-dist
Here is a different way to setup laravel, may be you guys will like it
Step 1:
Clone https://github.com/laravel/laravel or you may download zip also.
Step 2:
Navigate to downloaded folder in command prompt and run composer install
Step 3:
open the folder and rename .env.example to .env and update the credentials mentioned in file.
Step 4:
After these steps if you navigate to the directory from web-server it will cause an error No supported encrypter found. The cipher and / or key length are invalid. to fix this just run php artisan key:generate
Done!
Hope you guys like this way :)
You need to install all the laravel required dependency.
To do that, you need to tell composer to install everything needed.
Below is the command to use to install that's required in laravel composer.json.
composer install
Follow the installation guide from Laravel
Install Composer:
Like Laravel.com says: "Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable can be located by your system."
Type the following statement in the command line:
composer global require "laravel/installer=~1.1"
Create a fresh Laravel project in a specified directory with the "laravel new" command:
laravel new blog
You can also create a Laravel project using composer, like such:
composer create-project laravel/laravel --prefer-dist
If you want to learn laravel I seriously recommend you use laravel homestead with vagrant.
For this you need to:
Install virtualbox.
Install vagrant.
Install git.
Install ssh.exe (Download msysgit and copy the content of bin folder to git bin folder).
Install Homestead on Vagrant (Follow the steps on laravel/homestead documentation page).
Install Laravel on Homestead (Follow the steps on laravel/installation documentation page).
This method apply to Windows, Linux or Mac, only change the step 4 on linux or mac.

fuelphp Composer is not installed. Please run "php composer.phar update" in the root to install Composer

I am trying to install fuelphp.
And getting the error as
Composer is not installed. Please run "php composer.phar update" in the root to install Composer
In my xampp/php directory I run a command
php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
But once i run php composer.phar install composer could not find a composer.json in e:\xampp\php
How can i resolve and run fuelphp successfully can anyone help.
As of 1.7.1, we no longer supply the composer.phar file in the zip. It only has a limited shelf life (30 days before it starts complaining).
Instead we suggest you install composer yourself, either locally (specific for this fuelphp installation) or globally so you only have to install it once for all your projects.
Composer is a tool for dependency management in PHP, like npm for Node.js, bundler for ruby, and others.
It reads a file called composer.json with the dependent libraries your project needs and, finally, installs (downloads) them for you.
Fuelphp can be installed using composer, but there are several packages.
So, you need to create the composer.json with all needed fuelphp packages. Open notepad, save a file with the name composer.json (be sure to save it with ".json" extension) and put this content:
{
"require": {
"fuelphp/upload": "2.0.1",
"fuelphp/event": "0.2.1",
(...)
}
}
Note you need to insert at "(...)" the others fuelphp packages and the needed versions. You can check them all at https://packagist.org/ (type fuelphp at search). Packagist is the main Composer repository.
More information about Composer at this link.
Let me know if you need more information about it.
If you are running FuelPHP 1.7, the download comes with all Composer files you need. You need to run php composer.phar install in the root directory of FuelPHP (the same directory that contains the public folder and the fuel folder.
As long as you have v1.7 (I'm not sure if earlier versions contain the files), that directory will contain composer.json and composer.phar.
In folder fuelphp-1.7 (latest), there are two files: composer.phar and composer.json you need to cd into that folder and run:
php composer.phar install
If you don't have php in your path, you should do something like:
e:\xampp\bin\php\php5.4.16\php.exe composer.phar install
Use the full path to your php.exe. Remember your current working directory should be fuelphp folder where composer.phar and composer.json are.

Categories