v3 now uses symfony3 components
Silex 1.3 supports symfony3 so lets use it :)
Note: as symfony3 doesnt support php5.4 anymore, we dont either!
the one from knplabs that was used before seems to be unmaintained and wasnt matching the dependencies anymore.
So i decided to take it over and renew it a bit. Check it out!
I started to use Docker as dev enviroment for my projects, so i added dev & prod Docker support.
For the sake of simplicity it uses a single container with Apache and PHP7.
If you have Docker and docker-compose on your machine just spin it up with docker-compose up and check on localhost:8088.
(If there is more extensive documentation available concerning assetic + CompassFilter, please stop reading on and let me know!)
If you take a look at the filter class itself (it is CompassFilter in the generic Assetic\Filter namespace), you should recognise several option values that you can use in your application wide config.yml file.
But first you have to install the framework plugin following these instructions.
This small composer.json file is used in a project i am working on atm, feel free to use it at own risk. I will provide non-periodical updates and hopefully soon a full upgrade to symfony 2.1.x including doctrine orm 2.2.x.
I still did not get the point regarding dependency resolution, so i simply “composed” the composer file by writing down my own requirements (“i want only the hottest, newest stuff!!”, then tracked down the error messages, removing them by explicetly writing down the missing dependencies by using the latest “dev-*” versions. After that i tried to run the project, which actually did not work, but selective downgrade of some of the bundles (framework, security-extra blahblah) finally did the job. Continue reading “[Symfony 2] composer.json for a assumed-stable symfony 2 distribution”
Using MongoDB in your Silex Project is quite easy.
I will show this with my Superleansilexplate and will integrate it there as an example.
Since i dont want to integrate MongoDB in Superleansilexplate it will just become an additional gist.
Given you have some smaller amount of data like a counter that needs to be stored or other loose coupled datasets, we simply speak to MongoDB “directly” and store the data via Doctrine MongoDB Abstraction Layer.
Since i presume the Data / Document Structure isnt that complex we dont use Doctrine MongoDB ODM (the Object Document Mapper).
If you want to use it instead, try this Silex Extensions.
The HTTP_CACHE resp. the reverse proxy of Symfony is a pretty cool thing.
And as it is build-in Silex it can speed up the already fast micro framework massivly,
wich is good for me, as i am mainly workin with Silex right now.
To enable it you have to register it first like its shown in the docs:
Alright, there is a bundle for H5BP for symfony2 and there is Assetic, you can probably use both with Silex and thats just fine.
But in case you want to keep your Silex project lean (since its micro) you can use Twig and H5BP only and build / deploy your app from the outside.
With a little tuning of the H5BP build, of course / unfortunatly. (Ok thats the caveat)
So i have a structure like so:
(this is the webroot, here is js/css/images, all that asset stuff and the index, here we use the recommended H5BP stuff’n’structure)
(this is outside of webroot and here are all of the *.twig) Continue reading “Silex, Twig und HTML5 BoilerPlate”