parse.com-php-library
parse.com-php-library copied to clipboard
Composer support
Added namespaces and Composer support
pls merge this commit, we really need it for frameworks like Symfony2
Hey I'll take a look at it again... I was 90% done with a new version of the library that was composer ready when this came across. I haven't had time to finish my yet. So, let me check it out again this weekend and maybe it'll be a quick fix until I can get my new version up.
hi, any update on this feature ? meanwhile i did my own by copying the classes but can't be easy updated without composer.
Thx in advance.
There is something can i do to help? :)
For those who want to have this repo via Composer, add this to your composer.json file:
{
"repositories": [
{
"type": "package",
"package": {
"name": "apotropaic/parse.com-php-library",
"version": "2.0",
"source": {
"url": "https://github.com/apotropaic/parse.com-php-library",
"type": "git",
"reference": "master"
},
"autoload": {
"classmap": ["/"]
}
}
}
],
"require": {
"apotropaic/parse.com-php-library": "2.0"
},
"scripts" : {
"post-install-cmd": "<specify class to fix issues>",
"post-update-cmd": "<the same class once again>"
}
}
"scripts" section is required in order to fix a few issues:
- In parse.php need to replace all "include" to "include_once" so it won't mess up with composer autoloader.
- parseConfig.php should be added.
- Typo in parseQuery.php, need to replace "installation" with "installations".
class ComposerFix
{
public static function postInstall()
{
$source = __DIR__ . '/parseConfig';
$distDir = __DIR__ . '/../../../vendor/apotropaic/parse.com-php-library';
$dist = $distDir . '/parseConfig.php';
copy($source, $dist);
$fileName = $distDir . '/parseQuery.php';
file_put_contents($fileName, str_replace("'installation'", "'installations'", file_get_contents($fileName)));
$fileName = $distDir . '/parse.php';
file_put_contents($fileName, str_replace('include ', 'include_once ', file_get_contents($fileName)));
}
}