Welcome Guest, Not a member yet? Register   Sign In
Poll: Would you like to set the main directories with absolute paths?
You do not have permission to vote in this poll.
No
66.67%
2 66.67%
Yes
33.33%
1 33.33%
Total 3 vote(s) 100%
* You voted for this item. [Show Results]

\Config\Paths with absolute paths
#1

(This post was last modified: 10-26-2018, 07:53 PM by natanfelles. Edit Reason: typo: phpdoc -> phpunit )

See:

- Issues with ROOTPATH
- Propose Directory Structure



First, my idea was to create a composer.json file:

Code:
{
 "require": {
   "codeigniter4/framework": "dev-develop"
 }
}


Install and then copy the application and public directories to the same level as the composer vendor folder.

Then define absolute paths to the directories in the \Config\Paths class. But it is not possible due to issues related to the above links.

My paths were like this:

PHP Code:
<?php namespace Config;

class 
Paths
{
    public 
$systemDirectory 'vendor/codeigniter4/framework/system';

    public 
$applicationDirectory 'application';

    public 
$writableDirectory 'writable';

    public 
$testsDirectory 'tests';

    public 
$publicDirectory 'public';

    public 
$viewDirectory 'application/Views';



The main issue I found so far is that ROOTPATH is the directory by which the system is oriented, and it always stays one level above FCPATH.

One suggestion then is to be possible to completely modify the paths, something similar to what @titounnes requested, but there is an issue that @scalla has already notified.

I suggest that each standard ROOTPATH file be moved to the directory it belongs to. The phpunit.xml.dist into tests. The spark, env, the folders application and writable into project.

Since the \Config\Paths class will be solely responsible for defining these locations. So, in the index.php and spark files, the line to do the boostrap would look like this:


PHP Code:
$app = require rtrim($paths->systemDirectory,'/ ').'/bootstrap.php'

Given that, in both files, the user would need to update only the line of the Paths class:

PHP Code:
// Location to the Paths config file.
$pathsPath 'application/Config/Paths.php'


Going further, the system folder could be named codeigniter. And application to app Wink

These changes would make it easier to customize the locations and, as I mentioned earlier, to use the composer (or not) to make updates.
Reply
#2

(This post was last modified: 10-26-2018, 04:39 PM by titounnes.)

I agree with your proposal. With current structure, I have to readjust the config / paths.php every time I update through composer.
Reply
#3

I think is is properly handled in https://codeigniter4.github.io/CodeIgnit...poser.html#
Reply




Theme © iAndrew 2016 - Forum software by © MyBB