Comments (19)
Actually my intention was to allow Cilex to support both \Cilex\ServiceProviderInterface and \Silex\ServiceProviderInterface extensions. This way you do not have a hard dependency on Silex but you can re-use extensions.
The only problem is that a lot of extensions have \Silex\Application as a hardcoded dependency; to ally for compatibility should this be \Pimple (which both Silex and Cilex share as common ancestor)
from cilex.
I have tried to move the ServiceProviders from silex to pimple in the past, but it's not so easy to do, because many of them rely on $app->before
and $app->after
. I'm not sure if there's any easy way to move those out.
But I agree it would be cool to have pimple-only ServiceProviders that can be re-used without silex.
from cilex.
Couldnt it be possible to create a Cilex\SilexServiceProvider which takes a Silex\ServiceProvider and just calls register on it?
from cilex.
alternatively if there would be some interface like PimpleApplicationInterface
, then the ServiceProviderInterface
could maybe be moved to Pimple as well?
from cilex.
What methods would PimpleApplicationInterface
have? Are you thinking of register(ServiceProviderInterface $foo)
?
Adding interfaces to Pimple just to support the common functionality of Silex and Cilex could be invasive. Pimple is beautiful as a one-file library, and this is a bit like turning it into Doctrine Silex Common.
from cilex.
@jmikola yes .. register()
is what i was thinking .. but agreed that its kinda ugly dumping this into Pimple .. not sure if there is an alternative place where we could share this.
from cilex.
In terms of extracting a common Silex ApplicationInterface, there are definitely parallels between Silex applications and Cilex. When you consider the Symfony Console component differentiates between commands and applications, matching command names is similar to Silex's routing. So before()
and after()
could be repurposed as setup and tear-down hooks for CLI commands. I think the term for this is middleware?
If we extracted that interface in Silex, we could depend on it (if only for the interface).
from cilex.
This is a bit off topic, but a friend of mine just pointed me to Flask-Script, which seems very close to what we're doing here: extracting a CLI framework from a micro web framework, albeit in Python. Here's an example of it in action: https://github.com/jmoiron/jmoiron.net/blob/master/manage.py
from cilex.
bump
from cilex.
@igorw what was the solution we discussed at phpday again? simply type hinting pimple and then checking if the relevant methods exist?
from cilex.
Yes, however we have done some work on the silex service providers to move non-service related calls into a separate boot() method. The register() method is still typehinted to Silex\Application
though. Maybe we can change it to Pimple.
from cilex.
I would need to review the new changes but using Pimple as base class could work well
from cilex.
For the record: @igorw has submitted a PR at the Silex repository to attempt to make Cilex and Silex compatible on a ServiceProvider level. The PR and its discussion can be found here: https://github.com/fabpot/Silex/pull/352
from cilex.
Is there some way we can move this forward? The more Cilex is being used the more I get the feeling people want shared ServiceProviders (for example @simensen). I know there are several PRs out there but discussion seems to stagnate around them
from cilex.
ping
from cilex.
bump, wondering what is the resolution of this
from cilex.
Same here, @mvriel I've done my own attempts at this, so far with equal results, any news on your side?
from cilex.
Unfortunately not; I have lowered the priority for this myself as there are more pressing matters that need my attention. I do not see a lot of movement here
from cilex.
It would seem that Pimple version 2 now has a common ServiceProviderInterface that is used by Silex. I think it is time for Cilex v2 that makes use of that functionality ;)
from cilex.
Related Issues (20)
- What's the best way to access the application (and by extension app configuration) from the command class? HOT 2
- create a phar project with cilex as dep HOT 2
- Changing Output, and Input HOT 2
- Tag a new stable release HOT 3
- Dependency issues with latest pimple v1.1.x HOT 1
- Move to Pimple 2.* HOT 5
- Cilex/Silex ServiceProvider Incompatibility HOT 3
- Update ConsoleServiceProvider to use Pimple's ServiceProviderInterface HOT 2
- Replace PharCompiler with box-project HOT 2
- cilex.phar has errors
- cilex.phar has errors HOT 3
- Generating loads of commands dynamically from config files HOT 1
- ReadTheDocs.org HOT 1
- Add dependency support for pimple ~2.0 HOT 6
- Need new label HOT 1
- Impossible install branch develop HOT 1
- Is this package still being maintained ?
- Nested commands HOT 1
- Update the download link for box
- ConfigServiceProvider missing HOT 5
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 cilex.