jmathai / epiphany

A micro PHP framework that's fast, easy, clean and RESTful. The framework does not do a lot of magic under the hood. It is, by design, very simple and very powerful.
https://github.com/jmathai/epiphany
Other
686 stars 139 forks source link

Allow to load files and routes at run time. #74

Open Criptos opened 11 years ago

Criptos commented 11 years ago

I'm using Epiphan for a fairly big project, so, needing to load all the application and classes in one single point, makes the code to complex and the load to heavy, so to break down the loading I create a lazyload so when you detect a route, you load a file where you can have more definitions and code loaded, this way I can manage a fairly good integration and delegation, and avoid to many routes in a single file.

challgren commented 11 years ago

In EpiRoute.php you have debug code at line 100 On Sep 16, 2013 1:28 AM, "Criptos" notifications@github.com wrote:

I'm using Epiphan for a fairly big project, so, needing to load all the application and classes in one single point, makes the code to complex and the load to heavy, so to break down the loading I create a lazyload so when you detect a route, you load a file where you can have more definitions and code loaded, this way I can manage a fairly good integration and

delegation, and avoid to many routes in a single file.

You can merge this Pull Request by running

git pull https://github.com/Criptos/epiphany master

Or view, comment on, or merge it at:

https://github.com/jmathai/epiphany/pull/74 Commit Summary

  • Added lazyRoute function to allow to segment the load of information based on routes
  • Added explanation to getRoute()->lazyLoad("path", "filename");
  • Document fix and code cleaning

File Changes

  • M docs/Route.markdownhttps://github.com/jmathai/epiphany/pull/74/files#diff-0(11)
  • M src/EpiRoute.phphttps://github.com/jmathai/epiphany/pull/74/files#diff-1(29)

Patch Links:

jmathai commented 11 years ago

Is the use case for this to define a set of routes that belong to a blog as a lazy route of /blog* which loads the more specific routes?

How many routes are you loading now at which point it becomes too large?

Criptos commented 11 years ago

El sep 26, 2013 5:00 PM, "Jaisen Mathai" notifications@github.com escribió:

Is the use case for this to define a set of routes that belong to a blog as a lazy route of /blog* which loads the more specific route

Yes...

How many routes are you loading now at which point it becomes too large?

At 50 it started to feel uncomfortable, when hit 100 it started to become a mess... math was telling me we could get as far as 400+ routes and a lot of mergin issues...

Splitting the load routes has simplified the development, produced less merges and allowed more focus when delegating.

— Reply to this email directly or view it on GitHub.

jmathai commented 11 years ago

@Criptos Thanks for the response. Just trying to wrap my head around this a bit more.

Is the benefit more to do with code management than performance, then?

Criptos commented 11 years ago

Humm... i really didn't made speed measures... but memory usage was lower... the aplication is quite big to really get a performance hit... we are porting the application ifscore, www.ifscore.info check the gallery links to get an idea... I even have a blog comparing several restful api.. and why I choose epi El sep 26, 2013 5:21 PM, "Jaisen Mathai" notifications@github.com escribió:

@Criptos https://github.com/Criptos Thanks for the response. Just trying to wrap my head around this a bit more.

Is the benefit more to do with code management than performance, then?

— Reply to this email directly or view it on GitHubhttps://github.com/jmathai/epiphany/pull/74#issuecomment-25208946 .

Criptos commented 5 years ago

Hello, new maintainer :) This still works, and I'm still around :)