{"id":20254800,"url":"https://github.com/chippyash/slim-symfony-dic","last_synced_at":"2025-04-11T00:04:57.766Z","repository":{"id":56952079,"uuid":"50248567","full_name":"chippyash/Slim-Symfony-Dic","owner":"chippyash","description":"Integration of Slim framework with Symfony Dependency Injection Container","archived":false,"fork":false,"pushed_at":"2018-07-17T22:09:57.000Z","size":60,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T00:04:38.302Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chippyash.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-23T17:10:51.000Z","updated_at":"2021-08-05T12:01:19.000Z","dependencies_parsed_at":"2022-08-21T09:20:18.871Z","dependency_job_id":null,"html_url":"https://github.com/chippyash/Slim-Symfony-Dic","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chippyash%2FSlim-Symfony-Dic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chippyash%2FSlim-Symfony-Dic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chippyash%2FSlim-Symfony-Dic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chippyash%2FSlim-Symfony-Dic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chippyash","download_url":"https://codeload.github.com/chippyash/Slim-Symfony-Dic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248317708,"owners_count":21083528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T10:34:58.200Z","updated_at":"2025-04-11T00:04:57.743Z","avatar_url":"https://github.com/chippyash.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chippyash/Slim-Symfony-Dic\n\n## Quality Assurance\n\n![PHP 5.6](https://img.shields.io/badge/PHP-5.6-blue.svg)\n![PHP 7.1](https://img.shields.io/badge/PHP-7.1-blue.svg)\n[![Build Status](https://travis-ci.org/chippyash/Slim-Symfony-Dic.svg?branch=master)](https://travis-ci.org/chippyash/Slim-Symfony-Dic)\n[![Code Climate](https://codeclimate.com/github/chippyash/Slim-Symfony-Dic/badges/gpa.svg)](https://codeclimate.com/github/chippyash/Slim-Symfony-Dic)\n[![Test Coverage](https://codeclimate.com/github/chippyash/Slim-Symfony-Dic/badges/coverage.svg)](https://codeclimate.com/github/chippyash/Slim-Symfony-Dic/coverage)\n\nThe above badges represent the current development branch.  As a rule, I don't push\n to GitHub unless tests, coverage and usability are acceptable.  This may not be\n true for short periods of time; on holiday, need code for some other downstream\n project etc.  If you need stable code, use a tagged version. Read 'Installation'.\n\nSee the tests and the [Test Contract](https://github.com/chippyash/Slim-Symfony-Dic/blob/master/docs/Test-Contract.md) for additional information.\n\nPlease note that developer support for PHP5.5 was withdrawn at version 3.0.0 of this library.\nIf you need support for PHP 5.5, please use a version `\u003e=2,\u003c3`\n\n## What?\n\nProvides a [Symfony Dependency Injection Container V2](https://symfony.com/doc/2.8/service_container.html)\nor [Symfony Dependency Injection Container V4](https://symfony.com/doc/current/service_container.html)\nfor a [Slim Application V3](http://www.slimframework.com/).  The DI container depends on the \nversion of PHP you are using.  \u003c 7, then V2, \u003e=7.1 then V4\n\n## Why?\n\nThe Slim framework is great for lightweight sites and in version V3 adopts the interop\ninterfaces for dependency injection containers. Slim V3 uses the Pimple DI by default.\nSymfony DI does not yet support the interop interface definition.\n\nThis small library supports the integration of the easy to use, yet powerful\nSymfony version of a DI container with the lightweight Slim Framework, giving \nyou the ability to create great, maintainable and configurable web sites quickly.\n\nThe Builder supports XML DI definition.  XML is the most powerful and complete form \nof Symfony DI configuration.  The Builder also supports Yaml DI definition.  Many\ndevelopers prefer to put the parameters into a Yaml file and service definitions into\nan XML file.  The supplied minimal example files demonstrate this usage.\n\n## How?\n\nTo create and return a Slim\\App object with a Symfony DIC:\n\n\u003cpre\u003e\nuse Chippyash\\Type\\String\\StringType;\nuse Slimdic\\Dic\\Builder;\nuse Slim\\App;\n\n$xmlDiFileLocation = '/mysite/cfg/dic.production.xml';\n\n/**\n * @var Slim\\App\n */\n$app = new App(Builder::buildDic(new StringType($xmlDiFileLocation)));\n\u003c/pre\u003e\n\nPlease see the examples/dic.slim.v2.xml, examples/dic.slim.v3.xml and examples/dic.slim.yml \nfiles for the minimum that you need to build the DIC with to support Slim.  You are \nrecommended to put the files in with the rest of your DI configs and use the `\u003cimports\u003e` \ndirective in your main config to pull it in.\n\nYou can add to the compilation process by utilising the pre and post compile functions.\nThis is often useful for setting up synthetic services or initialising parameters in\nthe DI container.\n\n### Register a PreCompile function\n\nThe PreCompile function is called just before the container is compiled.\n\n\u003cpre\u003e\nuse Slimdic\\Dic\\ServiceContainer;\nuse Symfony\\Component\\DependencyInjection\\Definition;\n\nBuilder::registerPreCompileFunction(function($dic) {\n    //set a parameter\n    $dic-\u003esetParameter('foo', 'bar');\n    //set up a synthetic\n    $dic-\u003esetDefinition('bar', (new Definition())-\u003esetSynthetic(true));\n});\n\n$app = new App(Builder::buildDic(new StringType($xmlDiFileLocation)));\n\u003c/pre\u003e\n\n### Register a PostCompile function\n\nThe PostCompile function is called just  after compiling the container.\n\nThe post compile function only really makes sense to set a synthetic definition as\nafter compilation the rest of the DI Container is frozen and cannot be changed.\n\n\u003cpre\u003e\nuse Slimdic\\Dic\\ServiceContainer;\n\nBuilder::registerPreCompileFunction(function($dic) {\n    $dic-\u003esetDefinition('foo', (new Definition())-\u003esetSynthetic(true));\n});\n\nBuilder::registerPostCompileFunction(function($dic, $stage) {\n    $dic-\u003eset('foo', $myFooService);\n});\n\u003c/pre\u003e\n\n## Changing the library\n\n1.  fork it\n2.  write the test\n3.  amend it\n4.  do a pull request\n\nFound a bug you can't figure out?\n\n1.  fork it\n2.  write the test\n3.  do a pull request\n\nor raise an issue ticket\n\nNB. Make sure you rebase to HEAD before your pull request\n\n## Where?\n\nThe library is hosted at [Github](https://github.com/chippyash/Slim-Symfony-Dic). It is\navailable at [Packagist.org](https://packagist.org/packages/chippyash/slim-symfony-dic)\n\nCheck out [ZF4 Packages](http://zf4.biz/packages?utm_source=github\u0026utm_medium=web\u0026utm_campaign=blinks\u0026utm_content=slimsymfonydic) for more packages\n\nSee [My blog](http://zf4.biz) for ramblings on coding and curries\n\n### Installation\n\nInstall [Composer](https://getcomposer.org/)\n\n#### For production\n\n\u003cpre\u003e\n    \"chippyash/slim-symfony-dic\": \"\u003e=3,\u003c4\"\n\u003c/pre\u003e\n\nto your composer.json \"requires\" section\n\n#### For development\n\nClone this repo, and then run Composer in local repo root to pull in dependencies\n\n\u003cpre\u003e\n    git clone git@github.com:chippyash/Slim-Symfony-Dic.git Slimdic\n    cd Slimdic\n    composer install --dev\n\u003c/pre\u003e\n\nTo run the tests:\n\n\u003cpre\u003e\n    cd Slimdic\n    vendor/bin/phpunit -c test/phpunit.xml test/\n\u003c/pre\u003e\n\n## License\n\nThis software library is released under the [BSD 3 Clause license](https://opensource.org/licenses/BSD-3-Clause)\n\nThis software library is Copyright (c) 2016-2018, Ashley Kitson, UK\n\n## History\n\nV1.0.0 Initial Release\n\nV1.1.0 Update dependencies\n\nV1.1.1 Add link to packages\n\nV1.1.2 Verify PHP 7 compatibilty\n\nV1.1.3 Update Slim dependency to 3.* \n\nV1.1.4 Update dependencies\n\nV1.1.5 Update build script\n\nV2.0.0 PHP 7.0 support withdrawn, updated to use 7.1, primarily because of underlaying \nlibraries that don't support 7.0\n\nV2.0.2 Fix unit tests to run under PHP 7.1\n\nV3.0.0 BC Break.  Withdraw support for PHP \u003c5.6\n\nV3.1.0 Change of license from GPL V3 to BSD 3 Clause \n\nV3.1.1 dependency update","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchippyash%2Fslim-symfony-dic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchippyash%2Fslim-symfony-dic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchippyash%2Fslim-symfony-dic/lists"}