I would like to clone the symfony-standard-edition create project call but with some custom requirements.
So i dont need Swiftmailer or Doctrine ORM but would like to have the PaginatorBundle.
I tried to copy and edit the composer.json from the standard-edition and did a:
composer.phar install
but that did just install the vendor dir and not the rest like app folder, etc.
So how can i run:
composer.phar create-project symfony/framework-standard-edition myproject
with my edited composer.json?
You can just do composer.phar create-project symfony/framework-standard-edition myproject to bootstrap the whole project, then remove the packages you don't need from composer.json and run update to delete them.
Otherwise you can also git clone the symfony/symfony-standard repository on github, and then start from there, running composer install once you tweaked the composer.json file.
Related
so my friend and i are working on a project and we install laravel/ui package on his device to use Auth:routes, but after i pull from github it says "In order to use the Auth::routes() method, please install the laravel/ui package." even though i also pulled all file that he push and the gitignore file is empty. does this mean i have to install laravel/ui package in my device too? because i dont want to have the client to installed all those again when we finished and send the folder to our client. we used laravel 7.24 btw
You just need to regenerate the classes as :
composer dump-autoload
you should open the terminal on your project root directory and run :
composer install
on your system.because probably the vendor directory(where the packages are located) added to .gitignore
if vendor not added in .gitignore try to run:
composer dump-autoload
I want to download Laravel UI package via composer and I have got this error
Seems like due to internet issue you can't access packagists site (which composer uses to get the packages) which is causing the installation to fail.
run a fresh composer create-project laravel/laravel command, copy replace your composer.json content with the old projects composer.json. Do the same with .env file
and run composer install. then u can run "composer require/laravel/ui"
I don't get how the create-project works in composer. Lets take Laravel as example.
I can install this PHP framework with the following command:
composer create-project laravel/laravel --prefer-dist
This command installs the framework for me leaving me with a few folder in the root of my dir:
app
bootstrap
public
vendor
Plus some files.
But when I simply use the following composer command:
composer require laravel/laravel --prefer-dist
composer install
Then this only installs the vendor folder. No other files and folders are downloaded by composer.
How come? What is so different? How does composer know what other files to get when I use the create-project laravel/laravel command and why do I only get the vendor folder when I do require laravel/laravel?
require will add a dependency to the composer.json file and load it into the vendor directory as you have correctly noticed.
create-project on the other hand will clone the dependency, i.e. use the dependency as a template for a new project. Take a look at the repository behind laravel/laravel: https://github.com/laravel/laravel
What is the difference between composer and composer.phar?
Example:
composer install
composer.phar install
Is there a reason why I keep seeing code writen using composer.phar all the time when composer does the same?
There is no difference - composer.phar is the executable and composer can be an alias or symlink for it, depending on the way you've installed composer. As rob006 pointed out, there can be multiple ways to install composer: the official documentation at https://getcomposer.org/doc/00-intro.md#globally recommends to move the downloaded PHAR file to /usr/local/bin/composer which will make it callable through composer for all users of your system.
If you would move the file to another destination, like /usr/local/bin/composer.phar, the same composer binary would be available under that different command composer.phar.
And finally, if you would not have the chance to install composer globally, you could put it under either name in any local place
Hi I've recently downloaded Laravel as a PHP framework, I've installed composer and have got that working, I've got it to create my project as per the Laravel website
composer create-project laravel/laravel --prefer-dist
However when I use the above line this installs my project in the c:\users\guti directory however I want it to be installed in c:\xampp\htdocs.
I've seen another question on stackoverflow and it talks about amending the composer.json file but I'm not sure whether this is the route I should be taking as I've done a computer search for this file and this file exists as part of the laravel framework so does it make sense to amend this file?
Any composer experts on hand to point me in the right direction?
composer create-project laravel/laravel .
Installs in your current directory =)
You should specify your destination directory where you want to create the project, from the command prompt, type cd C:\xampp\htdocs then press enter. After that, type following code on the command prompt and press enter
composer create-project laravel/laravel my-laravel-project
Here my-laravel-project will be your project folder.
The composer.json file is used to setup some configurations (for Dependency management) during installation of the package via packagist.
Visit getcomposer.org for more information.
Whenever
composer create-project laravel/laravel .
Doesn't work properly for whatever reason, I just
laravel new temp
And then move the contents of the new application into the folder I do want ; )
I needed to do this myself. In the directory I wanted it installed, I did:
laravel new --force .
And it seems to be working well so far.
This works for me on Ubuntu 20.04, Composer version 2.1.6:
cd your-directory
composer create-project laravel/laravel ./
TL;DR
composer create-project --prefer-dist laravel/laravel directory-name
Move files to preferred folder if needed (e.g. to ../)
Why don't laravel new /.?
laravel new project-name not always works good on different systems, so you need to edit PATH variable multiple times to add laravel command to cli (at least on OSX it's not that easy as on Ubuntu).
composer create-project --prefer-dist . may not work because of not empty directory (e.g. in JetBrains IDE's, which creates folder .idea/ which doesn't shows in IDE's 'project' view, only on 'project files'). Exception message looks like
[InvalidArgumentException]
Project directory ./ is not empty.
So, if you know what you doing, do as you wish, on the other way, especially if you want as few problems as possible, do the steps from the top lines of this answer.
P.S. I'm speaking english not as good as i want to do, so, anyone, feel free to correct me.