php & composer: psr0 vs psr4 examples

Trabla: php & composer: psr0 vs psr4 examples

Solving:

Example composer.json 


 {
        "autoload":{

        "psr-0":{
            "Luracast\\Restler":"vendor/"
        },

        "psr-4":{
            "v1\\":"src/class/v1/",
            "v2\\":"src/class/v2/"
        }

    }
}

Folder structure

.../myapp/composer.json


.../myapp/src/class/v1/Login.php
<?php 
namespace v1;
class Login{
  //....

?>

 .../myapp/src/class/v2/Log.php

<?php 
namespace v2;
class Log{
  //....

?>
 .../myapp/vendor/Luracast/Restler/Restler.php 

<?php 
namespace Luracast\Restler;
class Restler{
  //....

?>

No comments:

Post a Comment