Remove composer from PHP project? - composer-php

Is there a way to build project, created with composer, remove all «trash» files and save all dependencies?
Or i can use it as is - upload all directories to server and that's all?

Related

Is npm install affecting Laravel project?

I am working on the Laravel project, and intend to use Vue.js as its client-side scripting. When I searched the internet, I found that I had to use the npm install command. My question is if I run the order, will it affect the project I'm working on?
For example, in the directory structure or variable section?
It will change only package.json and /node_modules folder (it will download vue.js last version package into this folder) in your root directory. But it won't affect your existing codebase until you don't use them via importing or accessing it. It is like installing a package with composer, but not using it. The downloaded package will stay in /vendor folder and package name in composer.json, composer.lock

not using nodes in laravel

Is that possible to completely remove node_modules folder from laravel app and not using it?
My app doesn't require any npm packages and I'm not using echo or pusher or any other API's that requires npm packages, then
Is it OK to remove this unnecessary folder in my app or somehow laravel
needs it to work?
If your project doesn't require node packages then you can remove it, it's not necessary to run Laravel project. But if you're using VueJS, or NodeJS then you need it.
composer update not download node packages, it only installs packages in vendor folder, node_modules is different which includes node packages.
If you want to install node packages, then use npm install command to install it again.
Hope this will helps you!
It is safe to remove the folder. The normal workflow would be to compile all CSS and JS files before deployment and copy them to the public/ directory, rendering the node_modules/ obsolete for deployment.
If anything breaks after you removed it, you can still bring it back with npm install.

Installing Composer and Packagers - first time

I have never used Composer, but I want to use PHPSpreadsheet package, and it is recommended that Composer is used.
I am on a MAC using XAMPP and Netbeans.
I have installed Composer, and I have run the following command to get and install the PHPSpreadsheet package.
php ../../Composer/composer.phar require phpoffice/phpspreadsheet
I am running this in my project folder, (hence the ../../ to where Composer.phar is located.
This downloads the files into a vendor folder in my project folder.
What should I do then? Do I need to keep it in the Vendor folder, or can I move into a folder of my choice?
Netbeans has Composer options in the menus, but as far as I can see, this is for creating dependencies rather than installing packages.
I know I am totally missing the point of Composer somewhere, but have spent hours just trying to get this work.
Many thanks
You should really start with the docs -> https://getcomposer.org/doc/01-basic-usage.md
You have to keep the vendor directory - this is where all dependencies are kept. If you require more packages - then they will be installed in that directory.
After requring the package you have to load it so the PHP will know all the classes. Composer comes with great autolader. It is located by default in vendor/autoload.php. So what you have to do now is to require this file in your project. After that all classes from composer packages will be loaded automaticaly each time you use them in the code :)
I hope this will help you with this great tool. Cheers.

What files are need to upload after composer required <package>?

So my hosting company not support composer. and reuploading all Laravel framework php files are too much take time just for one composer package. what are files need to be uploaded to hosting after composer required?
all i know is "package" folder in vendor folder, composer.json, and "config" file in config folder. is there any other files and folder?
You must upload vendor/composer and vendor/autoload.php too..
I hope this works
The file that you forget: Facades, ServiceProvider
the easiest way is reupload all vendor directory. or track all vendor directory using git, so you can archive the different after update composer and upload it

Let Composer to install plugins to another directory

I have framework wich uses plugins as subdirectories in plugin/ directory. Plugins are git submodules and it works just fine. But some plugins require 3rd party libraries and I want to use Composer ti install them. Also there are dependencies between plugins which could be handled by Composer too.
I tried to use composer, but it will install everything into vendor/ directory, which is wrong because plugins must go into plugin/ directory. There is also core of the framework in core/ and application specific files in app/ directory.
What is the best way to use Composer in this scenario?
There should be a way for Composer to decide which package is a plugin and should be placed in the plugins directory. In composer, there is a special type setting which you should use in that case.
Then you can use a custom installer to install the special plugin types in the plugin directory.

Resources