Welcome Guest, Not a member yet? Register   Sign In
I dont like composer, am I a bad person?
#1
Shocked 

I see composer growing up so much, never used until now just because I love CI so much and I think v4 is so awesome but after trying composer and seeing that vendor folder full of things I prefer to put addons manually in my environment.

For experts, what do you do with that vendor folder?  My app is working fine without all those things composer puts there but I see almost all packages you look for are using composer.

For example I created a new app, then installed only hashids library ( https://github.com/vinkla/hashids ) and resulted in vendor folder like you can see in attached img but in my current project i dont even have a vendor folder ci files are under system dir and everything is ok.

Attached Files Thumbnail(s)
   
Reply
#2

(This post was last modified: 11-19-2020, 08:31 AM by captain-sensible.)

I didn't used to use composer either, still don't like the duplication of stuff , and as a Linux slackware user like doing everything manually, but composer comes into its own with updates and dependencies .

What i did to vendor so far is this:

Code:
vendor
├── autoload.php
├── codeigniter4
│   └── framework
│       └── system
├── composer
│   ├── ClassLoader.php
│   ├── LICENSE
│   ├── autoload_classmap.php
│   ├── autoload_files.php
│   ├── autoload_namespaces.php
│   ├── autoload_psr4.php
│   ├── autoload_real.php
│   ├── autoload_static.php
│   └── installed.json
├── kint-php
│   └── kint
│       ├── LICENSE
│       ├── README.md
│       ├── build
│       ├── composer.json
│       ├── init.php
│       ├── init_helpers.php
│       ├── resources
│       └── src
├── laminas
│   ├── laminas-escaper
│   │   ├── CHANGELOG.md
│   │   ├── COPYRIGHT.md
│   │   ├── LICENSE.md
│   │   ├── README.md
│   │   ├── composer.json
│   │   └── src
│   └── laminas-zendframework-bridge
│       ├── CHANGELOG.md
│       ├── COPYRIGHT.md
│       ├── LICENSE.md
│       ├── README.md
│       ├── composer.json
│       ├── config
│       └── src
└── psr
    └── log
        ├── LICENSE
        ├── Psr
        ├── README.md
        └── composer.json


if you look at main :

Code:
ash-5.0$ tree -L 1  CI4
CI4
├── README.md
├── app
├── builds
├── composer.json
├── composer.lock
├── env
├── license.txt
├── phpunit.xml.dist
├── public
├── spark
├── tests
├── vendor
└── writable
the only thing missing that I think is crucial is system ,which is why i did spring cleaning of vendor but left system. After clear out i just ran:

Code:
composer dump
//this refreshes autoload
CMS CI4     I use Arch Linux by the way 




Arch Book
Reply
#3

(This post was last modified: 11-19-2020, 09:19 AM by eggbert.)

Quote:For experts, what do you do with that vendor folder?  My app is working fine without all those things composer puts there but I see almost all packages you look for are using composer.

Why does the vendor directory bother you?  If your app is working fine with the dependencies that composer installs, why worry about it?  I don't understand why anyone would want to waste their time dealing with dependencies manually. Do you actually want to go to each dependency's website and download an individual zip file, unzip it, copy and paste it into your project directory, and then do that all over again when you need to update it for 50 different libraries?  Why would anyone want to create this extra work for themselves? Please help me understand.

(11-19-2020, 08:15 AM)captain-sensible Wrote: I didn't used to use composer either, still don't like the duplication of stuff , and as a Linux slackware user like doing everything manually, but composer comes into its own with updates and dependencies .

What i did to vendor so far is this:

Code:
vendor
├── autoload.php
├── codeigniter4
│   └── framework
│       └── system
├── composer
│   ├── ClassLoader.php
│   ├── LICENSE
│   ├── autoload_classmap.php
│   ├── autoload_files.php
│   ├── autoload_namespaces.php
│   ├── autoload_psr4.php
│   ├── autoload_real.php
│   ├── autoload_static.php
│   └── installed.json
├── kint-php
│   └── kint
│       ├── LICENSE
│       ├── README.md
│       ├── build
│       ├── composer.json
│       ├── init.php
│       ├── init_helpers.php
│       ├── resources
│       └── src
├── laminas
│   ├── laminas-escaper
│   │   ├── CHANGELOG.md
│   │   ├── COPYRIGHT.md
│   │   ├── LICENSE.md
│   │   ├── README.md
│   │   ├── composer.json
│   │   └── src
│   └── laminas-zendframework-bridge
│       ├── CHANGELOG.md
│       ├── COPYRIGHT.md
│       ├── LICENSE.md
│       ├── README.md
│       ├── composer.json
│       ├── config
│       └── src
└── psr
    └── log
        ├── LICENSE
        ├── Psr
        ├── README.md
        └── composer.json


if you look at main :

Code:
ash-5.0$ tree -L 1  CI4
CI4
├── README.md
├── app
├── builds
├── composer.json
├── composer.lock
├── env
├── license.txt
├── phpunit.xml.dist
├── public
├── spark
├── tests
├── vendor
└── writable
the only thing missing that I think is crucial is system ,which is why i did spring cleaning of vendor but left system. After clear out i just ran:

Code:
composer dump
//this refreshes autoload

What is the point of doing this?  Seems like you take a chance of introducing breakage and/or regressions by moving things around in vendor, for no apparent benefit. Also how would this scale? You going to do this for each environment your app runs on?  Sorry, I don't get it. Seems like a bad idea.
Reply
#4

(This post was last modified: 11-19-2020, 09:43 AM by captain-sensible.)

your right eggbert,

there is risk of breakage but for instance :

bash-5.0$ du -sh vendor
48M vendor
//thats one of my dev vendor files; admittedly it does have bootstrap IV scss in it.



I should be in Ghana if it were not for corvid 19 ; if 3rd world developers are taken into consideration then a lot rely on "pay as you go data" from a usb dongle or equivalent. When and if i go out there i'm not happy to turn a blind eye to vendor and eat 48 megabytes of data in one go to load local dev up to live server. I don't need duplication of everything because i use rsync or Gsrync to backup everything .
CMS CI4     I use Arch Linux by the way 




Arch Book
Reply
#5

(11-19-2020, 09:41 AM)captain-sensible Wrote: your right eggbert,

there is risk of breakage but for instance :

bash-5.0$ du -sh  vendor
48M vendor
//thats one of my dev vendor files; admittedly it does have bootstrap IV scss in it.



I should be in Ghana if it were not for corvid 19 ; if 3rd world developers are taken into consideration then a lot rely on "pay as you go data"  from a usb dongle or equivalent. When and if  i go out there i'm not happy to turn a blind eye to vendor and eat 48 megabytes of data in one go to load local dev up to live server. I don't need duplication of everything  because i use rsync or Gsrync to backup everything .

Yes, but one of the benefits of composer is that you do NOT have to upload your vendor directory.  Run 'composer install' on the server, that way you are only moving a round a single composer.json file rather than a 48 MB directory.  Also, you shouldn't be commiting all those deps to your vcs either.  Composer actually is more efficient space wise as well.
Reply
#6

Quote:Why does the vendor directory bother you?  If your app is working fine with the dependencies that composer installs, why worry about it?  I don't understand why anyone would want to waste their time dealing with dependencies manually. Do you actually want to go to each dependency's website and download an individual zip file, unzip it, copy and paste it into your project directory, and then do that all over again when you need to update it for 50 different libraries?  Why would anyone want to create this extra work for themselves? Please help me understand.


Why It bothers me?  Because I dont know what is all that  things composer puts there, what to do with all that?  I install a package and have 20 other folders there.

Im sorry I dont know what extra work are you talking about.  Take my example of hashids repo, instead of issuing a command and watch how it fills my vendor's folder of lots of things I dont know where they came I just downloaded the package to ThirdParty and add it to autoload, works like a charm.

Im sorry Im just trying to understand all this composer fever havent really used before.
Reply
#7

(11-19-2020, 12:03 PM)jnar Wrote:
Quote:Why does the vendor directory bother you?  If your app is working fine with the dependencies that composer installs, why worry about it?  I don't understand why anyone would want to waste their time dealing with dependencies manually. Do you actually want to go to each dependency's website and download an individual zip file, unzip it, copy and paste it into your project directory, and then do that all over again when you need to update it for 50 different libraries?  Why would anyone want to create this extra work for themselves? Please help me understand.


Why It bothers me?  Because I dont know what is all that  things composer puts there, what to do with all that?  I install a package and have 20 other folders there.

Im sorry I dont know what extra work are you talking about.  Take my example of hashids repo, instead of issuing a command and watch how it fills my vendor's folder of lots of things I dont know where they came I just downloaded the package to ThirdParty and add it to autoload, works like a charm.

Im sorry Im just trying to understand all this composer fever havent really used before.


Most or all of those are codeigniter dependencies. It too depends on other libraries, just like your app depends on the hashids library. You can run

Code:
composer show --tree
 
To see what depends on what.  Or, if you look at the composer.json of each composer package you install you can see what it will bring in.  Although, you don't really need to concern yourself with it, unless you have a specific reason to know.

If you maintain a bunch of big php applications then life without composer would create a huge amount of bug-prone work.  Downloading zip files, copying files, making sure they're in the right place, etc.  Who wants to deal with all that when it can be automated by tools like composer?  I'd much rather run a single command like 'composer update' than to have to go hunt down an upgraded version of some obscure package.

Another advantage of composer is when you have multiple people working on the same project.  Everyone can be on the "same page" as far as what dependencies are required, as they are specified in a single place (composer.json). 

The advantages far outweigh any benefit of managing dependencies yourself, and I always surprised to see opposition to using tools like composer.
Reply
#8

@jnar Yeah I understand how you feel. I too hates having stuff automatically downloaded in my project, and that's why I don't use composer for my personal projects.

@eggbert In my opinion, if your projects need 50 external libraries to work, I think you're doing something wrong, or it's a huge project. I don't like to reinvent the wheel, but I don't see how a website would need that much dependencies without becoming an unmaintainable mess. Most of the time those libraries are very trivial to code yourself and the code quality is not alway very good. Sometimes they are made by code gurus, but sometimes they are made by people who learned PHP 2 months ago. So, like jnar said, I have trouble trusting all those dependencies that appears out of nowhere. Also, if decide to upgrade your application to something, like PHP 8, CodeIgniter 5, or whatever else, you're stuck until all those libraries are made available for the new version of PHP or CI...
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#9

All I do is just ftp everything to the root of my server and all folders and files are in the right place.

And just a note a lot of shared hosting will not allow Composer.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#10

I personally don't see the problem with composer, CI4 requires some packages to work. What you do next with it is up to you. I prefer CI checks everything before i manually have to update every single project in hope it's all ok so i do not have to do it once again.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB