最終更新:2018-03-13 (火) 16:54:36 (98d)  

composer.json/autoload はてなブックマークを見る
Top / composer.json / autoload

Autoload mapping for a PHP autoloader.

PSR-4 and PSR-0 autoloading, classmap generation and files includes are supported.

形式

PSR-4

  • Under the psr-4 key you define a mapping from namespaces to paths, relative to the package root.
        "autoload": {
            "psr-4": {
                "Controllers\\" : "controllers/",
                "Models\\"      : "models/",
                "Models\\Sub\\" : "models/sub/"
            }
        }
  • namespace? Controllers と宣言されたクラスは、controllers/の中

PSR-0

  • Under the psr-0 key you define a mapping from namespaces to paths, relative to the package root

関連