Is there any way to install laravel from only composer.json file by using
composer install
command. If i just copy composer.json from existing project it creates only vendor directory, but not app, database, etc.
I just want to load all laravel core files, project file structure and my custom package by using install command of composer.
Can someone help me with this?
You can install laravel with the command composer create-project --prefer-dist laravel/laravel <project_name> if you only want to use composer, this command is mandatory since it creates the directories you want.
See the documentation
I don't think you can.
Create a new laravel project or clone an old project from git. Then replace/update the composer.json, then run composer update, if its a new project or composer install, if you cloned a repo
I didn't find solution for this, maybe it's impossible.
So, i just create my package and manually copy my custom composer.json to project.
Related
How can i start project cloned from bitbucket, based on Yii2, on my localhost?
Composer is installed.
When i clone it, composer update give me nothing. composer create-project --prefer-dist yiisoft/yii2-app-basic inside this project dont work, with error "folder is not empty".
When i use this command composer create-project --prefer-dist yiisoft/yii2-app-basic without clone rep, its work good, and i cant clone in just created folder?
How i can run cloned yii2 project on my localhost? Help pls. Sorry for my grammar.
Error after composer update (install)
Repository content.
Pluggins in install-plugins.bat
`php composer.phar require --prefer-dist mihaildev/yii2-ckeditor "*"
php composer.phar require kartik-v/yii2-widget-select2 "#dev"
php composer.phar require kartik-v/yii2-widget-datetimepicker "*"
php composer.phar require --prefer-dist yiisoft/yii2-imagine
php composer.phar require zelenin/yii2-slug-behavior "~1.5.1"
php composer.phar require --prefer-dist moonlandsoft/yii2-phpexcel "*"
php composer.phar require guzzlehttp/guzzle
php composer.phar require electrolinux/phpquery
UPD: Screen repository
It seems like, for some reason, the publisher of the repository added the dependencies to an extra file instead of them being added to the composer.json the usual way.
You can deal with this a couple of ways, both should give you the same results.
Option 1:
Install the Yii2 app into a new folder:
composer create-project --prefer-dist yiisoft/yii2-app-basic
Clone the repository you want to use into another folder.
Drag&drop the contents of the cloned repository into the Yii2 folder, it will overwrite the Yii2 files, preserving the ones that don't change and adding the ones that don't exist.
Add the extra dependencies, either by running the install-plugins.bat script or by hand running them one by one in the console.
Your project should be runnable now.
Option 2:
Clone the repository you want.
Copy the Yii2 composer.json into the root folder of the repository.
Run composer install
Add the extra dependencies, either by running the install-plugins.bat script or by hand running them one by one in the console.
Either way should give you the same results, you will end up having a vendor folder in the root of your project with all the dependencies, specified by composer.json and composer.lock that you need to run the project.
I am thinking to create a project skeleton in the following format via a composer package that I am going to create.
/app
/config
/web
/vendors
Just wondering about this command
composer create-project vendor/name path
--repository-url=http://repo.yourcomposerrepo.com
What do I need to put in the composer.json in order to create the file structure I want? Is it done through the shell script or it just copied the files from the repositories?
For symfony it will create the files and folders automatically through composer create-project. Just wondering how do I achieve the similar thing for this case. When I looked at their repo it only contains one composer.json at https://github.com/symfony/skeleton
composer create-project symfony/skeleton blog
Thank you.
composer create-project will create a new directory with all the files that are part of that package and then it will run the installation for all the dependencies that are listed in that package's composer.json file.
If you want to have a better example to understand that, you can use the old way that we used to bootstrap Symfony applications (when not using the Symfony installer). Then applications were based on the Symfony Standard Edition which you can find on GitHub. Just run composer create-project symfony/framework-standard-edition and compare the result with the repository.
Using symfony/skeleton as the base package is a bit special. This package depends on Symfony Flex which is a Composer plugin that automatically applies so called recipes (see https://flex.symfony.com/) which will lead to newly created files when a package is installed (and clean them up on removal). But, this behaviour is special for Flex and thus nowadays Symfony 4 based application and not a good example for what composer create-project does by default.
I was working with a laravel project and, accidentally, removed vendor folder.
What should I do? Create a new project and copy it or download it anywhere else?
I had no additional composer dependencies installed.
Just run composer install after cding into the Laravel project's directory.
The Vendor folder is created by running composer install. It contains only the packages which you have asked composer to track in the composer.json file. If you have a composer.phar file in the root of your application run php composer.phar install.
https://getcomposer.org/doc/00-intro.md is probably your best source for additional information.
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.
I already know how to install by going through composer.json to add laravel/cashier, then composer update, and then add some line in app provider. But where does this folder go? What other things does it add in my app to make it fully functional? What is the work flow of composer update in Laravel 4?
Composer is a dependency management tool for PHP. It is not a typical package manager as it does not install libraries globally, but on a per project basis. It uses the file "composer.json" to install, update and remove libraries specified, including the version requested.
Composer creates an "autoload.php" file that, if included in your project, autoloads all libraries and classes and makes them available for use.
Typically, in a regular PHP project, you'd include the following line to bootstrap your project:
require 'vendor/autoload.php';
Now, when you execute composer install (for first time) or composer update (every time after), Composer adds/removes packages according to configuration made in "composer.json" file. All packages go in the directory "vendor" found in root of your project directory.
Laravel, by default, is a Composer project. You know when you execute composer create-project laravel/laravel my-app --prefer-dist to install Laravel, you are telling Composer to build a "composer.json" file with Laravel project and its dependencies, and run composer install. That's all!
Last but not least, Laravel, since it is a Composer project, includes "autoload.php" file and autoloads all packages within that project by default. You will notice "vendor" directory in the root directory. In Laravel 5 project, if you navigate to "bootstrap/autoload.php" file, you will see Laravel includes "autoload.php" file: require __DIR__.'/../vendor/autoload.php';
To answer your question about manually installing Laravel Cashier, Laravel Cashier is a package made specifically for Laravel, and as such, is not meant to be used on regular PHP project, unless you use specific classes and do some tweaking. To manually install Laravel Cashier, if you go to the following link, you will find link to "laravel/cashier" GitHub repository, from where you can manually download Zip file or clone the repository using git:
https://packagist.org/packages/laravel/cashier
I hope this adequately answers your questions - I kept it as simple as I could. Let me know if you have any other questions.