symfony - how does psr-0 and composer work? -
I will ask questions with an example. Say I have a project directory.
Project Vendor Sample Vendor src composer.json First of all I want to know that I have kept the musician. To install libraries in Jason "Directory", do the correct file in the project directory? Second, say I have the following lines: Composer. Jason
"autoload": {"psr-0": {"Samplevendor \\ package": "lib /"}} Then the composer project Will the class in relation to root configure the samplevendor \ package \ sampleclass to configure autoloading? I would like to ask after looking at the following lines in the symfony2 composer. Locked file:
"autoload": {"psr-0": {"theory \\ general \\ annotation \\ Update: I found the namespace map in autoload_namespaces.php which does not look as per psr-0: 'Principle \ Common \ Annotation \ '= & gt; Array ($ seller vendor. / Theory / comment / lib ')
Jason is the best idea to place files in the top directory, based on requirements in their project, but for pure PHP (and HTML / CSS / JS) projects. In this way the composer will be able to find if you want to make a library or want some good side effects. (There are lots of them that do not directly affect the composer or the performance of your software). This is a good idea to run
composer.json . Musician init will ask you about a vendor name and software name. I advise you to give a reasonable answer. Apart from this, you can add yourself as a developer, can add some dependencies now (not necessarily required), and eventually create the initial file. PSR-0 autoloading means that the prefix given to namespace or class name (Remember, underscore_name name_name_place_emulation) is to be searched in the directory, i.e. \ Namespace \ Class A class named "psr-0" is configured as: {"namespace \\": "src"} srv / namespace / class.php (If there is no file, then another component is capable of loading that exact square, so it is not immediately failed to auto-load Shall - Musicians will register a failure and see whether later could autoload definition load). The fact is that you see different definitions in the autoload_namespaces.php file for the required codes. The composer has to load them from the various directories located inside the vendor , and in the composer.json file will autoload your own classes from the location given in your autoload section.
Comments
Post a Comment