Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added broker.php as a binary to composer.json + made autoloader more …

…universal to make binary reusable
  • Loading branch information...
commit 58a3168ccb6aeb1f69f8506093c3f2827e115587 1 parent bd01526
Mateusz Heleniak authored
Showing with 28 additions and 2 deletions.
  1. +25 −0 autoload.php
  2. +1 −1  broker.php
  3. +1 −0  composer.json
  4. +1 −1  index.php
View
25 autoload.php
@@ -0,0 +1,25 @@
+<?php
+
+/**
+ * This file is part of rg\broker.
+ *
+ * (c) ResearchGate GmbH <bastian.hofmann@researchgate.net>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+function includeIfExists($file)
+{
+ if (file_exists($file)) {
+ return include $file;
+ }
+}
+
+if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
+ die('You must set up the project dependencies, run the following commands:'.PHP_EOL.
+ 'curl -s http://getcomposer.org/installer | php'.PHP_EOL.
+ 'php composer.phar install'.PHP_EOL);
+}
+
+return $loader;
View
2  broker.php
@@ -8,7 +8,7 @@
* file that was distributed with this source code.
*/
require __DIR__ . '/config.php';
-require __DIR__ . '/vendor/autoload.php';
+require __DIR__ . '/autoload.php';
$cli = new \Symfony\Component\Console\Application('rg\broker', '0.1.0');
$cli->setCatchExceptions(true);
View
1  composer.json
@@ -18,6 +18,7 @@
"slim/slim":"1.6.2",
"dflydev/markdown":"dev-master"
},
+ "bin": ["broker.php"],
"autoload":{
"psr-0":{
"rg":"src/"
View
2  index.php
@@ -8,7 +8,7 @@
* file that was distributed with this source code.
*/
require __DIR__ . '/config.php';
-require __DIR__ . '/vendor/autoload.php';
+require __DIR__ . '/autoload.php';
$application = new \rg\broker\web\Application();
$application->run();
Please sign in to comment.
Something went wrong with that request. Please try again.