Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extend autoloading to support multiple folders #439

Closed
wants to merge 6 commits into from
Closed

extend autoloading to support multiple folders #439

wants to merge 6 commits into from

Conversation

sopitz
Copy link

@sopitz sopitz commented Jun 6, 2014

I introduced multiple folders in my application to have kind of a layer based structure extending the usual MVC concept (external system interfaces, internal system interfaces, ...). It comes in handy to have those included into the autoloading as you would need to require() all classes manually.

Possible Issue: The autoloader loads all requested classes if found. This might lead to security violations. What do you think?

panique and others added 6 commits April 27, 2014 17:09
This approach makes it easier to roll out updates on certain
environments without always overriding certain config properties (like
db-pass which should differ from environment to environment)
@panique panique closed this Jun 6, 2014
@chambelix
Copy link

I know that this "issue" is closed... but sopitz I also do this for my use. But in my approach the autoloader look for a file inside any folder on "libs". This way all php classes can be organized and when we have a lot of classes this realy is a problem.

I also do the autoloader as a class this way in the constructor and when you instanciate the autoloader you can set a small local cache for the directory structure inside "libs" to boost the things up on the next call.

best regards

@sopitz
Copy link
Author

sopitz commented Jul 1, 2014

@chambelix can you post your solution?
One benefit I see in that .ini file is, that I can specify directories in any other folder as well. I always use different folders for internal system interfaces, external system interfaces, .... (thats kinda how my architecture works) and even some files in public folders (e. g. templates you load within the application to replace placeholders, ...) can be autoloaded then.

@chambelix
Copy link

@sopitz yes sure ... will Panique want code here ...because is closed.

About the solution... for the INI file i did not see the need. As I see it, the "libs" folder must be organized as you want and on demand. If you want an "accounts" folder that will keep all php accounts related files and then because a new structure that you are thinking you want to call it "users"... you just rename it... on my approach this is possible freely without INI file.

About other folders of the MVC I did not have that need...but why not... what about the footprint for a solution of this kind on all MVC folders? Is that realy necessary?

I hope you understand my english.

@panique
Copy link
Owner

panique commented Jul 1, 2014

Hey guys! First: Thanks for the commits and the genereal discussion, it's always good to get things improved. But the "problem" is: When new features come in, the project gets more complex, more complicated to setup and also need a lot of testing (which is usually my job).

The main problem of the project is that lots of people have problems setting this up, even if there are copy & paste tutorials.

I think for the 3.0 version of the project an enviroment switch and different enviroment configs for 2+ configs are a MUST, definitly, but let's move slowly here, these changes are important and should be well-thought.

=> Let's add multiple environments/configs in a few months, when the summer in Europe is over (and I've time for reseach, checking, and testing etc.)

@rajsquid
Copy link

rajsquid commented Jul 1, 2014

First of all a huge thanks to Panique for writing/testing and delivering this login project.I have a step by step registration process so I had to change the code a little bit and that's fine.What I am interested in is to see how Sopitz has found a solution to support multiple folders.

If you can just give me/us some hints then that would be awesome.Cheers.

@slaveek
Copy link
Contributor

slaveek commented Jul 1, 2014

Please see first sopitz comment under:
make autoloading configurable

@rajsquid
Copy link

rajsquid commented Jul 1, 2014

Got it now. Thanks. I will go through the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants