### ライブラリ側
$ tree
.
├── composer.json
├── src
│ └── Muuu
│ └── Uuuu.php
└── test
/src/Muuu/Uuuu.php
class Dog {
private $name;
public function __construct($name){
$this->name = $name;
}
public function getName(){
return $this->name . "さん!";
}
}
$ git init
$ git add .
$ git commit -m “first commit”
$ git remote add origin
$ git push -u origin master
### プロジェクト側
composer.json
{
"name": "library/test",
"description": "Composer sample project",
"authors": [
{
"name": "hpscript",
"email": "hpscript@gmail.com"
}
],
"type": "project",
"minimum-stability": "dev",
"require": {
"nuuu/muuu": "*"
},
"autoload": {
"psr-4": {"App\\": "src/"}
},
"repositories": {
"nuuu/muuu": {
"type": "vcs",
"url": "https://github.com/hpscript/package.git"
}
}
}
require_once "./vendor/autoload.php";
use App\Muuu\Uuuu;
$dog = new Uuuu::Dog("hoge");
$dog_name = $dog->getName();
echo $dog_name;
名前空間とclassの概念はよくわからん。。。