Creating a cakephp project using composer and setting the path - php

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

Related

unable to install Laravel via composer on Windows 7: "29 packages you are using are looking for funding"

I have installed Composer on windows 7 with the Composer-Setup.exe.
I am trying to install Laravel via Composer on Windows 7. I've tried 2 different commands:
composer global require laravel/installer
and
composer create-project laravel/laravel blog --prefer-dist
but they don't work.
In the end, there always a message: "29 packages you are using are looking for funding"
When I type composer fund to find out, it says that:
Composer could not find a composer.json file in C:\Users\Administrators
Does any one have any solution or any useful link?
Your composer.json file have some packages which have paid licence. However composer do not prevent installing Laravel due to this.
As per logs Laravel has been successfully installed. Can you check at the destination folder.

Cant install Laravel 6

I want to install Laravel 6 with Composer. I try with that command:
composer create-project --prefer-dist laravel/laravel laravel6 "6.*"
But i get that result:
[InvalidArgumentException]
Could not find package laravel/laravel with version 6.*.
Here is a screenshot
If i use:
composer create-project --prefer-dist laravel/laravel blog
It install the v5.5.28
Here is a screenshot
What can be the problem?
Which PHP version you are using? Laravel-6.* need PHP >= 7.2.0. Check your server-requirements for Laravel 6.*. May be you did not meeting the requirements for laravel 6.*. And after meeting the requirements run your command inside htdocs folder for xampp or www folder for wamp webserver.
your command are no longer supports so you should use:
composer create-project --prefer-dist laravel/laravel="6.*" laravel6
You forgot to add the "--prefer-dist " . So in your case, you have to use the:
composer create-project laravel/laravel --prefer-dist
in order to make it work. So just remove all the files from: d:\xampp\htdocs\laravel and then try again by following the below commands to your cmd (I guess you are using Windows!):
cd d:\xampp\htdocs\laravel
composer create-project laravel/laravel --prefer-dist
I think this should work for you just fine
You don't need to specify the version of Laravel 6. By default, Laravel 6 installs the latest version and its extension.
As I'm writing now the current and latest version of Laravel is: Laravel 6.0.4
The command below will install the current and the latest version in your laravel6 project.
composer create-project --prefer-dist laravel/laravel laravel6
You don't need to specify the version of Laravel 6. By default, Laravel 6 installs the latest version and its extension.
Via Composer Create-Project
Alternatively, you may also install Laravel by issuing the Composer create-project command in your terminal:
composer create-project --prefer-dist laravel/laravel your_project_name
I think it will be helpful for you. for more details visit laravel official website : https://laravel.com/docs/6.x/installation
Please check the permissions on the cache dir (/home/keynes/.composer/cache)
It's complaining it cannot write to this dir, or it may not exist.
Maybe it is installing an older laravel version from the cache dir.
Kindly upgrade your PHP version on your system.
Then install laravel commands
It will automatically install the lettest version depends on the PHP version.
Or you can mention on laravel command and set the laravel version like "6.0*" behind the laravel installer command.
I hope this will works 😊
The commands you are running should work. I would try clearing the composer cache:
composer clear-cache
and then
composer update
composer create-project --prefer-dist laravel/laravel="6.*" laravel6
before trying again. Looking at the screenshots there seem to be some permissions errors in the ~/.composer directory. This might also cause the composer clear-cache command to fail with an error.
So if clearing the cache doesn't work or you get an error, you might try moving the ~/.composer directory to a backup location, to force composer to regenerate it's settings.
mv ~/.composer ~/.composer.backup
And then try it again (be aware that composer update will likely take a noticeably longer time than usual and might be unresponsive for a while):
composer update
composer create-project --prefer-dist laravel/laravel="6.*" laravel6
If it still doesn't work, then you can restore the backup:
rm -rf ~/.composer
mv ~/.composer.backup ~/.composer
Then looking at the output of
composer config --list --global
might help determine the next thing to try.

What files to put on Bitbucket so that my teams could use?

I have a setup a Laravel 5 project locally and want to put it on bitbucket account so that my remote team mates can install it. Locally from command line I ran following command:
composer create-project laravel/laravel myproject --prefer-dist
which did everything. Now it sounds stupid to put all. I already uploaded my composer.json file. What instructions should I send out to team so that they just clone directory and install it? Do I dump each thing and they just clone it? Will they have to run composer create-project command anyway?
Here, no need to run composer create-project, they just clone the project and run composer install to deploy the project in their local.
As composer install will install all of the framework's dependencies, don't upload vendor folder to source (Bitbucket).
You can send following instructions
Project requirments
List of tools and technologies to run the project
Ex: PHP and mysql version, Frameworks (js, css) used and tools required NodeJs, Gulp, Bower or any other
Installation process
create folder project_name and clone project into it
open composer.phar and run composer install
setting up environment to run project with required tools

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.

Categories