duanjue7745 2014-09-09 05:28
浏览 62
已采纳

如何在我自己的系统是供应商时编写composer.json?

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.

  • 写回答

1条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 ABAQUS简单的带传动系统运转不了
      • ¥15 关于git actions自动部署的问题
      • ¥25 小程序 view wx:for 循环太多时,如何在循环结束执行某个事件?
      • ¥15 曲率模态差matlab程序计算
      • ¥15 大概算是比较简单的坐标系旋转问题
      • ¥15 关于#python#的问题:安装完gym环境后
      • ¥15 关于稳像云台姿态控制中相机姿态误差表征
      • ¥15 求sm16306s驱动例程
      • ¥15 本地生活媒体平台口碑选品怎么获得权限
      • ¥15 R语言 回归树/袋装树/随机森林预测