Welcome Guest, Not a member yet? Register   Sign In
Composer installing two CI4 in the same project?
#1

I started a new blank project (just for testing purposes) to see how to use CI4 with Composer. I then followed the instructions from CI Installation page by typing in the command prompt from the XAMPP htdocs folder:

Code:
composer create-project codeigniter4/appstarter test-project

After a little while it created the structure, but I am puzzled with the fact that I have the CI structure DUPLICATED. I have the four folders (app / public / tests / writable) plus the spare files at the root of my project and also within vendor/codeigniter4/framework. The only difference is that I have the system folder within the vendor/codeigniter4/framework but not in root.

I made a quick test by simply copying-pasting a controller and a view file into both app existing folders and did in my browser:

Code:
http://localhost/test-project/public

I could bet that it would work in the vendor/codeigniter4/framework/ and not in the root because this is where the system folder is, but for my surprise it was exactly the contrary: it worked for the root app but didn't for the vendor/codeigniter4/framework/, making me believe that the root app folder is the one I want to use for develop my site.

I have another CI4 project that I created manually by unpacking the zip file I downloaded from https://github.com/codeigniter4/CodeIgniter4 and in this one the system folder is at the same level of the app folder (there is not any vendor folder because I didn't use Composer).

OK, I could just look to the other side and happily start to write my site in the root app folder but I really don't feel good using something that I cannot understand. Also it doesn't look right to me that:

1) There are two almost identical CI4 structures in the same project; and
2) The system folder is NOT where it apparently should be.

Could someone please explain me this mess?

Dodgy
Recovering the wasted time...
Reply
#2

(This post was last modified: 05-02-2020, 11:40 AM by jreklund.)

What Appstarter does are downloading this Github project and making copies of app, public, tests, and writable to your root. This is the Appstarter itself.

Those copied folder are Your project files, and that's where you should develop your app. DO NOT touch anything in /vendor/. If you update Appstarter with "composer update" it downloads a new complete package from the framework project above and place it inside vendor. So you will get fresh copies of all framework files. So you can for example copy a new mimetype configuration.

1. It's the same except the system folder have a different place.
2. It's in the right spot, that's how Composer and dependencies are loaded nowdays.

https://getcomposer.org/doc/00-intro.md
Reply
#3

Thank you for the excellent answer jreklund!
Recovering the wasted time...
Reply




Theme © iAndrew 2016 - Forum software by © MyBB