I've started learning composer and I am trying to build a composer.json file where I want to put all my base classes (i.e. a custom framework) as a vendor itself with other dependencies.
The scenario is that I am building a small framework with Slim, Twig and Laravel ORM etc and I want to put my framework (with all of it's dependencies) in a folder outside of the document root as it can be used for several projects by a custom PHP included path either set in PHP.ini or by set_include_path(). I am using a VPS.
My folder structure is as follows:
/path/to/my/own/framework
|----> composer.json
|----> composer.lock
|----> vendor
|----> slim
|----> illuminate
|----> twig
|----> om
|----> OmFramework (this is my own framework)
|----> Factory
|----> BaseController.php
....
I have written the following composer.json so far:
{
"name": "....",
"description": "....",
"keywords": ["..."],
"license": "MIT",
"authors": [
{
....
}
],
"require": {
"php": ">= 5.3.0",
"slim/slim": "2.4.*",
"slim/views":"0.1.2",
"twig/twig": "1.*",
"twig/extensions": "*",
"itsgoingd/slim-facades": "dev-master",
"illuminate/database" : "4.*",
"cartalyst/sentry" : "2.*",
"ircmaxell/password-compat": "1.0.*"
},
"autoload": {
"psr-0": { "OmFramework": "." }
}
}
What should I write into the autoload section in order to load all my classes from om/OmFramework through the composer.json file? Any guidance would be highly appreciated.
The BaseController.php file:
<?php
namespace OmFramework\Factory;
class BaseController {
public function __construct()
{
//TO-DO:
}
public function sayHello()
{
echo 'Hello World!' . "
";
}
}
If I have missed any information that would help you to guide me, I will be happy to share those.
Please note that I am developing the framework locally and not using github for now. When it is ready, I will push it to github.