solid-layer / framework

https://www.phalconslayer.com/docs
15 stars 9 forks source link

Enhancement on Dispatcher #31

Open daison12006013 opened 7 years ago

daison12006013 commented 7 years ago

Right now, we are relying on the default way to run the phalcon application. What I am planning is to execute our own dispatcher and re-call all existing events it has.

But we also need to consider about Route Middleware and Controller Middleware.

cyberhck commented 7 years ago

reference: https://github.com/shouhuyou/phalcon-midddleware (we already have a dispatcher class, maybe update that one?) any thoughts?

daison12006013 commented 7 years ago

Yes, I might gonna update that along the middleware

cyberhck commented 7 years ago

make sure that we can return as much type of things possible from our controllers, let's say I create a class like so:

class IUser {
    public $id;
    public $name;
}

And I return an array with hundreds of those, it should be able to convert them to json and respond accordingly :) that'll make this so clean :)

Let me know when you're about to do that though, I want to have a look too :) (If I get some time after I'm done with SDK, actually SDK would be better if we do that dispatcher first, but we can change SDK pretty easily)

daison12006013 commented 7 years ago

What I will do is to provide an Http Kernel inside the dispatcher, so any class that can be injected will be possible, and a method that only executes those classes will be handle() something like that, so anything without much updating the dispatcher class.

As well to make the Core separate from Add-On

cyberhck commented 7 years ago

I meant to care about the return value, like Laravel, I should be able to return an array and it should make it json,

cyberhck commented 7 years ago

Shall I try and see if shouhuyou/phalcon-middleware can do our job? it'll be one less package which we'll need to maintain (provided we can do something about the dependency injection) or at least fork it in solid-layer organization?

daison12006013 commented 7 years ago

Let's build our own rather than including it, since it's not quite a major, and as I said, we will use Tactician as our middleware, I will work on it this weekend, just a bit busy right now.