Updating to the latest CakePHP 3.0 changes through Composer - composer-php

I have installed CakePHP 3.0 using Composer on my PC (Ubuntu). I want to update the changes of CakePHP 3.0.
I have used the following link provided at CakePHP docs after changing the required package, but I am getting the below error in the terminal:
ubuntu#ubuntu:~$ php composer.phar update Composer could not find a
composer.json file in /home/ubuntu To initialize a project, please
create a composer.json file as described in the
http://getcomposer.org/ "Getting Started" section
Could you please provide a proper suggestion?
Note: I have the composer.json file in the project directory, so what should I do in that case?

you should issue that command in the project directory, where composer.phar and composer.json should be present. So cd /var/www/html/cake_project first.

You can set environment path to use composer in command line or you only need copy file composer.phar into your project folder and then cd into you project folder.
Finally, you run command php composer.phar update
Composer that will auto update CakePHP latest version.
http://rao5s.vn

Related

How to install composer globally for laravel app in windows?

I have a question related to composer and laravel. My question is whenever I install the fresh laravel app using command :
composer create-project laravel/laravel blog
Inside my C://xampp/htdocs/ directory and then change path to C://xampp/htdocs/blog/, here I am unable to run the composer command but I had already installed composer from its official website globally in C://xampp/htdocs/ directory. So is there any way to use composer command globally whenever I install fresh laravel app, so that I don't want to install composer in the laravel app directory everytime.
Now I guess they provide direct setting up global installation,
Check here
I did it like this a lot earlier,
Change to the path (or you can add that directory to your path later), and run the installer as mentioned on composer download site to download composer.phar.
Create a new composer.bat file alongside composer.phar.
Using cmd.exe:
run
echo #php "%~dp0composer.phar" %*>composer.bat
Then set it to path environment variable(see this)
Test with a new terminal:
composer -V
Will return
Composer version 1.10.6 2020-05-06 10:28:10
go to composer website and download the exe file, you should have it gloablly if you install it that way.
Good luck ^_^

Laravel 5.5 install not generating .env file

I have installed laravel 5.4 multiple times.
Now I'm trying to install laravel 5.5 using same command And it doesn't work.
composer create-project --prefer-dist laravel/laravel blog dev-develop
It doesn't seem to have any errors on installation, only lot of suggestions.
But no key is generated and no .env file is created.
When I try to make php artisan key:generate
/public_html/blog/.env): failed to open stream: No such file or directory
Got the same problem days a go, the problem was because composer was not updated, solved it updating composer, you can run:
composer self-update
Or you can download the latest version there, then you can create the project again and the .env file will be automatically created.
I have this version
Composer version #package_branch_alias_version# (1.0.0-beta2) 2016-03-27 16:00:34
When I run composer self-update I get
[InvalidArgumentException]
Command "self-update" is not defined.
shell command: cp .env.example .env
If you just want to make current setup work, just try doing the following:
cp .env.example .env
php artisan key:generate
But as suggested by one of the answers here, you should update your composer if you have an old version. To check your installed version, do so with composer -v
This is happening because of your Laravel Installer or Composer version. I have faced the same problem and found following 2 different solutions:
Generally, you can solve with by running composer global update command and then run composer update command from your project directory. This solution basically updates your installer and then your project.
If still, you have this problem, then you need to run composer self-update command first and then run composer update command from your project directory. It will update your composer version and then your project.
Hope this information will help you to fix.

Laravel - Generating composer.json and artisan files?

I downlaod composer.phar and move to /usr/local/bin/ directory as composer, then I download laravel with
composer global require "laravel/installer=~1.1"
After I linked laravel to /usr/local/bin/ , I run "laravel new test" and I get
Composer could not find a composer.json file in /home/user/test
To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section
So laravel doesn't generate composer.json and artisan files
Can you help why?
Edit
I was going to format PC for some reasons. After I had formatted PC, I did above steps again and it worked.
laravel new hello
is working now
you should link your laravel to \composer\vendor\bin folder. After downloading the laravel installer run this command
export PATH="$PATH:~/.composer/vendor/bin"
and then run your laravel command.
If you want to install Laravel at current folder. You don't use global:
composer require "laravel/installer=~1.1"

Using Laravel "Warning:require(C:\wamp\www\laravel\bootstrap/../vendor/autoload.php): failed to open stream: No such

I am new to laravel, composer, and windows terminal. I am trying to setup laravel on my local host. I currently have wamp installed and I have used it before to create basic websites. However, I am now doing a bigger project that needs a framework so I decided to learn Laravel. I installed composer as indicated in the directions, but when i run the command
"C:\wamp\www>composer create-project laravel/laravel laravel"
i generate an error message that says
"[InvalidArgumentException] Project directory laravel/ is not empty."
When I open a browser and navigate to "localhost/laravel/public" I encounter the error message from the title of this thread:
"Warning:require(C:\wamp\www\laravel\bootstrap/../vendor/autoload.php): failed to open stream: No such
I have also added the appropriate environment variables from the composer instructions.
I am really lost at this point, and I have spent the past 4 hours trying to debug this.
I am running Windows 8 x64.
Edit:
I tried running composer install in C:\wamp\www and received an error message
Composer could not find the config file:
C:\ProgramData]ComposerSetup\bin Ti initialize a project, please
create a composer.json file as described in the
http://getcomposer.org/ "Getting Started" section "
The dependencies for your project are not installed. Just download composer from GetComposer.org and install it on your Windows Machine. Then navigate to your project root, you will see a composer.json file there. That file specifies all the dependencies of the project. Run composer update in that directory. Composer will then update or install all required dependencies and your application won't show the error then.
cd \wamp\www\yourproject
composer update
"C:\wamp\www>composer create-project laravel/laravel laravel"
"[InvalidArgumentException] Project directory laravel/ is not empty."
This means C:\wamp\www\laravel already existed when you attempted to run the command. Remove the folder, or change the create-project command to use a different folder name for your new project.
"Warning:require(C:\wamp\www\laravel\bootstrap/../vendor/autoload.php): failed to open stream: No such
You need to do a composer install from C:\wamp\www\laravel.
I figured it out! I was missing a folder called "vendor" and a file inside bootstrap called "compiled.php" Sorry for the inconvenience, and thank you for trying!
use the following command to get vendor folder in your project
composer install --no-scripts
i had the same problem but i just ran this command
composer install
to install all the dependencies

PHP Composer can't find composer.json file for my project

I have successfully installed Composer in the root directory (that was the default choice) on my Linux/Apache server using their installation guide. It's all been very simple so far, except for one php.ini tweak I've had to make (detect_unicode = Off) but now I'm stuck.
I'm trying to install Ratchet using Composer, with the use of this guide:
http://socketo.me/docs/install
It says I need to "create a file called composer.json in your project folder". So I created that file (with the contents they gave on their page) using the cPanel file manager, in my application's root directory. However, when I run Composer using:
php composer.phar install
PuTTy gives the following error message:
Composer could not find a composer.json file in /root
To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section
But this doesn't seem to make sense, why would I place the JSON file in the server's root if the documentation says to place it in the project folder? What am I missing?
I just found on other topic that you can use :
php composer.phar --working-dir=/home/user/folder/ update
It looks like you're executing php composer.phar install in /root path.

Resources