P.S. Its beta is ready to download although alot is missing but still its worth checking out.
My micro framework
Moderator: General Moderators
My micro framework
Hey everybody I am designing an open-source micro-framework for PHP its called MiMViC. I would love to open it to you people in its very early stages and would love to have some suggestions on it. You can also join hands with me
.
P.S. Its beta is ready to download although alot is missing but still its worth checking out.
P.S. Its beta is ready to download although alot is missing but still its worth checking out.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: My micro framework
That certainly is minimal. However, I think that the actual minimum does a lot more than that. A lot less than a lot of the frameworks you mention, but a lot more than you are doing.
(#10850)
Re: My micro framework
I read the tutorials. It seems awfully complicated for a minimal framework. Won't your controller end up with dozens of "get('/hello', 'say_hello');" lines? Isn't the point of a controller that it should handle new functions without having to register them?
Re: My micro framework
Well I would agree on that there would be many dispatch/get/post/put/delete but I think this is the precise point where power lies. It would helpful for you to only expose the ones you want and not the ones that u don't want. Plus the custom url will make it more readable and this is the way it is being done in many frameworks like Cherrypy and Sinatra. And I have seen commercial projects working this way. However I have took your opinion seriously and now looking for really good alternatives to this problem. Your suggestions are still welcomed.I read the tutorials. It seems awfully complicated for a minimal framework. Won't your controller end up with dozens of "get('/hello', 'say_hello');" lines? Isn't the point of a controller that it should handle new functions without having to register them?
Re: My micro framework
Its very initial i told youarborint wrote:That certainly is minimal. However, I think that the actual minimum does a lot more than that. A lot less than a lot of the frameworks you mention, but a lot more than you are doing.
Re: My micro framework
I thought the idea of an MVC framework was that it could take the parameters from the URL (either as plain GET variables, or through mod_rewrite) and figure out which view to display based on that, so I can write "specialoffers.php", drop it into the website, and /specialoffers will just work without needing any changes to the controller.mxp wrote:Well I would agree on that there would be many dispatch/get/post/put/delete but I think this is the precise point where power lies. It would helpful for you to only expose the ones you want and not the ones that u don't want. Plus the custom url will make it more readable and this is the way it is being done in many frameworks like Cherrypy and Sinatra. And I have seen commercial projects working this way. However I have took your opinion seriously and now looking for really good alternatives to this problem. Your suggestions are still welcomed.
That's how all the frameworks I've worked with work. In a large application with hundreds of views and dozens of models having to keep the controller up-to-date would be a right pain.
Re: My micro framework
What I like in a framework is modularity and extendability, preferably in conjunction with speed and ease of use.
Your framework is so far only based around functions, which makes it really hard to replace anything without rewriting parts of your framework.
It also is missing a strategy for loading external resources (or controllers/models/etc.), which means that the developer must be careful or he would have a mess.
The one thing I do like is the fact that you use that uri routing, it makes the URIs flexible.
Your framework is so far only based around functions, which makes it really hard to replace anything without rewriting parts of your framework.
It also is missing a strategy for loading external resources (or controllers/models/etc.), which means that the developer must be careful or he would have a mess.
The one thing I do like is the fact that you use that uri routing, it makes the URIs flexible.
Re: My micro framework
Well that's true but I just focused on minimality rather than classing. I can think of starting function name with framework name .i.e. get => mimivic_get. This will follow the same php legacy style but each time programmer will have to write extra mimvic_ ( and I know how frustrating it is at times).m4rw3r wrote:What I like in a framework is modularity and extendability, preferably in conjunction with speed and ease of use.
Your framework is so far only based around functions, which makes it really hard to replace anything without rewriting parts of your framework.
.m4rw3r wrote:It also is missing a strategy for loading external resources (or controllers/models/etc.), which means that the developer must be careful or he would have a mess.
Somebody already mentioned that. What I am planning is that I was thinking provide was class registration. So you can include the class file and just stick it to a URI route. It will automatically mount all of its functions as an extension to URI route; but again someone is gonna loose flexibility of having super custom URI and the concept of "MICRO" will be gone. So I guess I will have to look bit deeper into Cherrypy and other ones doing that so that I can decide on better basis the focus of framework. I am already checking out http://fewagainstmany.com/blog/python-m ... l-the-rage hope it will help improve
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: My micro framework
I tried to get the code to work with PHP 5.2 and did not have any success. There seem to be some errors in the code. Maybe it is PHP4 code.
(#10850)
Re: My micro framework
One thing you can do to make your framework extendable without forcing the user to edit the framework file is to wrap the framework functions in conditionals like this:
Then the framework user can replace the functions by creating their own variants before they load the framework core.
Code: Select all
if( ! function_exists('func_name'))
{
/**
* Some function for the framework.
*/
function func_name()
{
// ...
}
}Re: My micro framework
Pretty horrible way of doing it though. Why not just use objects and let people extend it that way?
Re: My micro framework
I know it is horrible, but if he wants to use functions, then that is the only way to replace them (except for using bytekit).onion2k wrote:Pretty horrible way of doing it though. Why not just use objects and let people extend it that way?
Re: My micro framework
Sorry there must be something you are missing. I have tested it for PHP 5.2 with Apache. What are your specs?arborint wrote:I tried to get the code to work with PHP 5.2 and did not have any success. There seem to be some errors in the code. Maybe it is PHP4 code.
Sure! Why not!m4rw3r wrote:One thing you can do to make your framework extendable without forcing the user to edit the framework file is to wrap the framework functions in conditionals like this:
I wish PHP could have a Python styled module; but I am still thinking "Should I warp them in static class methods?". I don't know yet!onion2k wrote:Pretty horrible way of doing it though. Why not just use objects and let people extend it that way?