Comments (13)
That's it? Then I'd lean more towards my first proposal: deprecate JsonStrategy
, and make a new JsonResponseStrategy
, tag 2.1.0
and be done with it.
from route.
Is it perhaps possible to make a different strategy and deprecate the old one? Then you'd be fine with a new minor.
I'm OK with a v3 as well, though.
from route.
If it's a small change, could you provide a branch to showcase the changes and discuss further based on that?
from route.
The discussion is going to dictate where I go with the code.
The breaking change would be here https://github.com/thephpleague/route/blob/master/src/Strategy/JsonStrategy.php#L19 where I would be adding the response object as the second parameter on this call.
from route.
And just have the original strategy ignore the new middleware functionality?
from route.
Maybe, does that seem plausible to you?
from route.
Yeah, I think that works for me.
RequestResponseStrategy
& JsonResponseStrategy
- can add middleware and will invoke them.
JsonStrategy
& ParamStrategy
- throw exception when dispatching on this strategy and a middleware is found?
JsonStrategy
- deprecated and will be removed in version 3.0.0?
from route.
Maybe actually have it as JsonRequestResponseStrategy
, that way all strategies going forward that are suffixed RequestResponseStrategy
can be used with middleware and we don't necessarily need to deprecate the JsonStrategy
?
That way we can continue to introduce strategies and it has a format. As in SomeStrangeFormatRequestResponseStrategy
etc down the line.
from route.
Deprecating JsonStrategy isn't necessary, no. But you'd want that to avoid confusion why there are 2 json related strategy classes, and if you want to remove it in v3.
from route.
Well there would be value in keeping both, the difference would just have to be explained thoroughly.
JsonRequestResponseStrategy
you would be expected to manipulate the response and return it.
JsonStrategy
would attempt to build a response from what you return (array, json string etc).
from route.
Route 2.x is not compatible with things like League\Relay right?
from route.
@CMCDragonkai I guess you meant https://github.com/relayphp/Relay.Relay ? League\Relay doesn't exist, afaik.
if you have a League\Route\RouteCollection
object, you can use [$routeCollection, 'dispatch']
(which is a PHP callable) to pass to Relay as a middleware.
from route.
Yes that's what I meant. Oh that's nice. Hopefully this can be clearer in the docs.
from route.
Related Issues (20)
- Feature request: custom attributes for route and route group accessible within a middleware HOT 6
- Catch Exception Best Way HOT 3
- Feature request: map with array of methods HOT 1
- Feature request: make $request available in getOptionsCallable HOT 2
- I cannot make post requests HOT 5
- Url resolve fails with 2 numeric parameter HOT 3
- Add an option to get the target route from the middleware HOT 2
- Why isn't the middleware stack executed for unmatched routes? HOT 2
- psr/simple-cache version constraints HOT 2
- Allow for empty route paths to be treat as the base route path HOT 2
- Nested groups are required HOT 1
- Feature request: Treat Route `$handler` that implements RequestHandlerInterface as callable
- Root exception class (and possibly, its children) not compatible with PHP7+
- Request matcher? guess if ServerRequest can be handled
- Dispatcher: handle and find HOT 1
- Feature: Extra map() options
- Method to get declared routes?
- How can I assign controller to errors http ? HOT 1
- Cannot Change Cache Key
- Is this package still actively maintained? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from route.