Created
June 13, 2012 03:36
-
-
Save k-holy/2921680 to your computer and use it in GitHub Desktop.
名前空間を使わないPSR-0のライブラリをComposerでオートロード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"repositories": [ | |
{ | |
"type":"package", | |
"package": { | |
"name": "phanda/pathtranslator", | |
"version": "dev-master", | |
"dist": { | |
"url": "https://github.com/k-holy/Phanda_PathTranslator/zipball/master", | |
"type": "zip" | |
}, | |
"source": { | |
"url": "https://github.com/k-holy/Phanda_PathTranslator.git", | |
"type": "git", | |
"reference": "master" | |
} | |
} | |
} | |
], | |
"require": { | |
"phanda/pathtranslator": "dev-master" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$loader = include realpath(__DIR__ . '/vendor/autoload.php'); | |
$loader->add('Phanda_PathTranslator', realpath(__DIR__ . '/vendor/phanda/pathtranslator/src')); | |
$translator = Phanda_PathTranslator::getInstance(); | |
var_dump(get_class($translator)); // string(21) "Phanda_PathTranslator" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once realpath(__DIR__ . '/vendor/autoload.php'); | |
$translator = Phanda_PathTranslator::getInstance(); // Fatal error: Class 'Phanda_PathTranslator' not found | |
var_dump(get_class($translator)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "phanda/pathtranslator", | |
"version": "dev-master", | |
"version_normalized": "9999999-dev", | |
"source": { | |
"type": "git", | |
"url": "https://github.com/k-holy/Phanda_PathTranslator.git", | |
"reference": "master" | |
}, | |
"dist": { | |
"type": "zip", | |
"url": "https://github.com/k-holy/Phanda_PathTranslator/zipball/master", | |
"reference": null, | |
"shasum": null | |
}, | |
"type": "library", | |
"installation-source": "source" | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// autoload_namespace.php generated by Composer | |
$vendorDir = dirname(__DIR__); | |
$baseDir = dirname($vendorDir); | |
return array( | |
'Phanda_PathTranslator' => $vendorDir . '/phanda/pathtranslator/src/', | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"require": { | |
"phanda/pathtranslator": "dev-master" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once realpath(__DIR__ . '/vendor/autoload.php'); | |
$translator = Phanda_PathTranslator::getInstance(); | |
var_dump(get_class($translator)); // string(21) "Phanda_PathTranslator" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "phanda/pathtranslator", | |
"version": "dev-master", | |
"version_normalized": "9999999-dev", | |
"time": "2012-06-12 23:51:37", | |
"source": { | |
"type": "git", | |
"url": "https://github.com/k-holy/Phanda_PathTranslator.git", | |
"reference": "14e6204e7c0a0223673ecc4ef06cd964b20fd784" | |
}, | |
"dist": { | |
"type": "zip", | |
"url": "https://github.com/k-holy/Phanda_PathTranslator/zipball/14e6204e7c0a0223673ecc4ef06cd964b20fd784", | |
"reference": "14e6204e7c0a0223673ecc4ef06cd964b20fd784", | |
"shasum": "" | |
}, | |
"require": { | |
"php": ">=5.2" | |
}, | |
"type": "library", | |
"installation-source": "source", | |
"license": [ | |
"MIT" | |
], | |
"authors": [ | |
{ | |
"name": "k-holy", | |
"email": "[email protected]", | |
"homepage": null, | |
"role": null | |
} | |
], | |
"homepage": "https://github.com/k-holy/Phanda_PathTranslator", | |
"autoload": { | |
"psr-0": { | |
"Phanda_PathTranslator": "src/" | |
} | |
} | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// autoload.php generated by Composer | |
if (!class_exists('Composer\\Autoload\\ClassLoader', false)) { | |
require __DIR__ . '/composer' . '/ClassLoader.php'; | |
} | |
return call_user_func(function() { | |
$loader = new \Composer\Autoload\ClassLoader(); | |
$composerDir = __DIR__ . '/composer'; | |
$map = require $composerDir . '/autoload_namespaces.php'; | |
foreach ($map as $namespace => $path) { | |
$loader->add($namespace, $path); | |
} | |
$classMap = require $composerDir . '/autoload_classmap.php'; | |
if ($classMap) { | |
$loader->addClassMap($classMap); | |
} | |
$loader->register(); | |
return $loader; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "phanda/pathtranslator", | |
"type": "library", | |
"description": "", | |
"keywords": [], | |
"homepage": "https://github.com/k-holy/Phanda_PathTranslator", | |
"version": "0.1.0", | |
"license": "MIT", | |
"authors": [ | |
{ | |
"name": "k-holy", | |
"email": "[email protected]" | |
} | |
], | |
"require": { | |
"php": ">=5.2" | |
}, | |
"autoload": { | |
"psr-0": { "Phanda_PathTranslator": "src/" } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment