I am just getting started both with Composer and Laravel.
I used Composer to include the Laravel installer:
"require": {
"laravel/installer": "v1.3.5"
}
When I ran the Laravel installer, it created a subdirectory with the name specified in the command: laravel new name. My project now has a composer.json file in both the root folder and the Laravel installation sub-folder.
Is this what's supposed to happen? It seems to me that I should only have one composer.json per project.
The best way to create a Laravel project using composer as describes below:: (on windows)
First go to file directory where you want to create the Laravel project say "C:\xampp\htdocs\laravel_5_4"
Press Alt+d then you will see directy URL will be highlighted, then type "cmd" and press Enter and command promt should appear.
Then just copy these code "composer create-project laravel/laravel ./ "5.4.*" --prefer-dist" and press Enter.
Sit back and relax, you are done.
Note: You can change the version as you want.
Related
I downloaded the Composer-Setup.exe and run to install Composer using the installer within few mouse clicks.
Opened terminal by typing in cmd. At the command prompt typed in Composer and saw all the information related to Composer which means I've installed Composer successfully on my Windows 10 machine.
I'm using XAMPP for development. So, C:\xampp\htdocs\ is my document root directory.
I created a new directory titled composer_demo in document root. The path of which is C:\xampp\htdocs\composer_demo
Now, I want to use composer in this directory. How should I use it?
I went through the documentation but it's not saying anything clearly whether I've to create the composer.json file manually inside the directory composer_demo or what?
Do I need to write the dependency package manually into composer.json file manually or what like?
{
"require": {
"monolog/monolog": "1.0.*"
}
}
I'm clueless. Please someone give me step-by-step instructions to use the composer inside my newly created directory composer_demo.
Thanks.
It is just like you said, create a composer.json file on your composer_demo folder, be sure that it is not a text file with a hidden .txt ending. Open the shell inside the folder using shift + right click and selecting ‘Open Command window here’ and run
composer install
This command tells Composer to install your dependencies, not Composer itself. It will search for a composer.json file and download every dependency you listed there into a vendor folder. Composer will generate a composer.lock file with the versions it downloaded so you don't have problems once the third party libraries update.
run .exe file
give php path to C:\xampp\php
and
give istallation path to C:\xampp\htdocs\composer_demo.
Run shell or cmd
go to your directory. with typing cd C:\xampp\htdocs\composer_demo\
now type your keyword ex:- for install php-ffmpeg composer require php-ffmpeg/php-ffmpeg
I wish to start a new symfony project,I want to use composer for the added advantages, but am having using the installed composer in my new project folder. The composer already installed came with Acquia dev desktop. when I run 'php composer.phar' in my new project folder I get this error "Could not open input file: composer.phar"
Double check where your composer.phar file is located.
If it has been installed into your old project's folder, simply copy it to the new folder.
If it has been installed globally (i.e: it is not in your old project's folder), then make sure you are using the right command, you might need to simply do composer install instead of php composer.phar
I'm learning Laravel and they say in order to create a new laravel site you have to make your folders like this:
--webshop
--root
--laravel (contains the laravel files)
--assets (contains the css,fonts,img,js from the public folder of laravel)
--.htaccess
--favicon.ico
--index.php
--robots.txt
--web.config
So as you can see I cut the containers of public folder inside Laravel and paste them in the root directory. So now I want to start the project and make it live on the localhost using Artisan commands but I don't know in which folder I have to make it live... For example root directory or laravel directory inside of root or something else... So can u please help me!
No, that's wrong. install laravel by composer like this:
composer require --prefer-dist laravel/laravel mysite
from inside mysite start project by run the artisan command php artisan serve and enter in the browser the url 127.0.0.1:8000
more information here
Have you checked Wamp or Xampp if you're on Mac/Linux, it's a PHP local server with phpmyadmin if you want to test out with a local database. Also have you created your project with composer create-project --prefer-dist laravel/laravel nameofyourproject? It installs all the basic folders you need to start using laravel right away, you can then copy those files on Wampp/Lampp and use localhost.
Refer to the documentation here:https://laravel.com/docs/5.4
If you have composer installed, use:composer global require "laravel/installer"
Now, to create a new project simply run : laravel new ProjectName.
No need to create a directory structure on your own.
I am new to Laravel and PHP programming. I am building a web application using laravel framework. When I create project using composer create-project it creates laravel files inside the laravel folder and I move all the files out of laravel folder and delete the empty laravel folder as belo.
-root folder
--app
--bootstrap
--config
--database
--public
-----------
After, I pushed the project to github and clone it from another computer and to add laravel files I execute composer install. Now laravel framework files are created inside a laravel folder instead of root directory.
-root folder
--app
--bootstrap
--config
--database
--public
--laravel
----app
----bootstrap
----config
----database
----public
How can I change the location, composer create the laravel framework files?
If you want to install laravel with composer then you should follow bellow this way:
Firstly install Composer according to your operating system.And then if you use xampp then create a project folder or run a command composer create-project --prefer-dist laravel/laravel blog this will create a root folder and a sub-folder named laravel.
Your problem is that when you secondly clone git form github that time you mixed up the main root folder that's why its duplicated.
I think you should re-install again according the given procedure.Hope this will solve your problem.
Another way: if in your pc have installed composer then you just clone the git and after that in the root folder (cloned git folder) run the command composer update.It should solve your problem.
Tricks: For opening root folder with command for windows operating system. Press select the root folder and Ctrl + Shift + right button of mouse then click the options Open command window here .
LARAVEL DOC.
Thanks.
Use this to create Laravel project
composer create-project laravel/laravel YourProjectName
I am starting a new PHP project, and I wanted to pull some php components such as "nesbot/carbon" using composer. But when I create a composer.json file and try to run composer install command, it downloads other files from my previous projects that I don's want.
Even when I try to run "composer install" with out having a composer.json file in an empty folder, it downloads some previous dependencies from caches. I didn't get that from where it's reading composer.json. Am stuck in the middle of project.
How can I create a fresh project with composer?
To create a fresh project with composer, run
$ composer init
in the root directory of that project.
For reference, see https://getcomposer.org/doc/03-cli.md#init.