framework icon indicating copy to clipboard operation
framework copied to clipboard

[5.0] [PROPOSAL] Change Package Structure

Open GrahamCampbell opened this issue 12 years ago • 11 comments

Should we update the default package structure to be more like the new structure in laravel/laravel?

We need to consider how to register the new structure in the service provider vs the old structure if we do change this (including moving to psr-4 autoloading).

Old structure:

/src
    /Vendor
        /Package
            PackageServiceProvider.php
    /config
    /lang
    /migrations
    /views
/tests
/public

Proposed new structure:

/config
/src
    PackageServiceProvider.php
/tests
/database
    /migrations
/resources
    /lang
    /views
/public

Or maybe we could just dump everything in the resources folder?

Alternative proposed new structure:

/src
    PackageServiceProvider.php
/tests
/resources
    /config
    /lang
    /migrations
    /views
/public

GrahamCampbell avatar Sep 24 '14 20:09 GrahamCampbell

I like the last one, looks a lot cleaner. Or really even the second one but just, anything that doesn't force me to mix my PSR namespace and random files like currently.

Anahkiasen avatar Sep 24 '14 20:09 Anahkiasen

Yeh. My first proposal was designed to match the app structure as much as possible, but I prefer the second option of putting everything in resources by default too.

For anyone wanting to use the second option, you can already do this by passing a third param to the package method in your service provider, but this proposal is for changing the default to this. :)

GrahamCampbell avatar Sep 24 '14 20:09 GrahamCampbell

I vote for the alternative one. Putting everything else into the resource folder looks more cleaner to me :+1:

ahmadshah avatar Sep 24 '14 20:09 ahmadshah

:thumbsup:

gvinaccia avatar Sep 24 '14 20:09 gvinaccia

Second looks cleaner for sure. I prefer that structure.

juukie avatar Sep 24 '14 21:09 juukie

One change that would make this easy is for the migrator to use the path set in the ServiceProvder.

Currently it is set hardcoded: https://github.com/laravel/framework/blob/master/src/Illuminate/Database/Console/Migrations/BaseCommand.php

I currently already use the second option except for migrations. +1 for the second to be default

marcvdm avatar Sep 26 '14 19:09 marcvdm

The migrations can be changed too in laravel 5 I guess. We should probably aim to remove that hard coded stuff too.

GrahamCampbell avatar Sep 26 '14 19:09 GrahamCampbell

:+1: like the alernative proposed structure, looks clean to me

garygreen avatar Sep 27 '14 12:09 garygreen

:+1: like the alternative structure

riotCode avatar Oct 09 '14 10:10 riotCode

Definitely a fan of the alternative structure! Mirroring L5's new concepts sounds awesome, and I never liked having to put config files in src.

atrauzzi avatar Oct 25 '14 19:10 atrauzzi

NB, the pull to implement this is: #5870.

GrahamCampbell avatar Oct 25 '14 20:10 GrahamCampbell