• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Composer question

#1
I am new to Composer. I ran the followoing comand:
Code:
composer create-project codeigniter4/appstarter project-root
After that I have codeigniter 4 installed in my root, nice!

But it is also installed in root/vendor/codeigniter4/framework.
Why is that? I just want to understand.
Reply

#2
You have read the documentation about it I take it? App Starter, it's the same as Adding CodeIgniter4 to an Existing Project. But without the need to copy the folder from CodeIgniter4.

So why use Composer?
You can update the framework automatically, no need to download a .zip file, unpack it etc.

Why do you have /vendor/...?
CodeIgniter4 itself are placed in the vendor folder as with all Composer packages. So that it can be updated outside your project. But you still need to have your own application somewhere, and that's what app, public, tests, writable etc comes in. Your develop your app in app, and NEVER touch the content in vendor.

If you download the zip folder/framework itself, you will find a system folder (instead of vendor). Difference here are that vendor contains ALL folders, not just the system. So when you are upgrading your application you can copy those files from the vendor folder (if a config file have changed) and replace yours. Your project also will have a smaller footprint, as you don't need to store the vendor folder yourself, that can always be re-downloaded with composer.
Reply

#3
Thanks. So after installation I have in vendor/... , let's say my own "original" of ci4 and the app starter creates sort of a copy of that original in my root, where I add my controllers models views etc.
Reply

#4
That's correct.
Reply

#5
(03-18-2020, 12:06 PM)jreklund Wrote: That's correct.
OK. I would like to have it described simpler for dummies like me. Just wait til I will try to understand autoload libraries. I'll be back Smile
Reply

#6
Hi, we are working on that behind the scene, discussing tutorials and such. Did you understand what the concept behind it after my description? So I know in what direction we need to take things.
Reply

#7
(03-20-2020, 10:58 AM)jreklund Wrote: Hi, we are working on that behind the scene, discussing tutorials and such. Did you understand what the concept behind it after my description? So I know in what direction we need to take things.
Well, to be honest, I don't understand it. 
The system folder stays "uncopied" for some reason. 
Besides from that I wonder why I want to update a file in vendor but not the same file in my root?

Let me take the file controller/Home.php as an example. You add a new method there in a new version of ci4.  
I see the update and I run composer update. Does both file change or only the one in vendor/  ?
If only the one in vendor/ change, how do I update the one in my root/app/controller/ ?
Reply

#8
There are no auto-patch system, as there are no system that's smart enough. If we would replace your files in e.g. /app/ when a new file becomes available (in /vendor/), it would complete remove any changes you have made. Destroying your website/application. That's why we don't replace any of those files.

You need to compare the changes made in /vendor/ with your own files in /app/. Differ them and apply it. There are no logic in those files, all that are handled in /vendor/. We may introduce some new configuration variables in e.g. /app/Config that needs updating, but as we don't know if you have changed them or not, we don't touch them. Better safe than sorry. As you (and others) will be going to this forum and scream of anger, for destroying your website/business.
Reply

#9
(03-21-2020, 10:20 AM)jreklund Wrote: There are no auto-patch system, as there are no system that's smart enough. If we would replace your files in e.g. /app/ when a new file becomes available (in /vendor/), it would complete remove any changes you have made. Destroying your website/application. That's why we don't replace any of those files.

You need to compare the changes made in /vendor/ with your own files in /app/. Differ them and apply it. There are no logic in those files, all that are handled in /vendor/. We may introduce some new configuration variables in e.g. /app/Config that needs updating, but as we don't know if you have changed them or not, we don't touch them. Better safe than sorry. As you (and others) will be going to this forum and scream of anger, for destroying your website/business.
That was a clear explanation, thanks.
And the system folder in vendor/ is used by my app, meaning that any update in that system folder affects my app, right?
Reply

#10
Yes, if we have introduced new features and fixed a set of bugs, you will get those improvements in your application right away. And with bad luck, you will also receive new bugs.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.