aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Tim Emiola <tbetbetbe@users.noreply.github.com>2015-03-30 09:34:20 -0700
committerGravatar Tim Emiola <tbetbetbe@users.noreply.github.com>2015-03-30 09:34:20 -0700
commit675de61e4ba46f6910eab9051ea77ee73cdf8c28 (patch)
tree29136b110563455e704d4bdca72a75ca7d40e107
parentbc6f3f04d81dbe71433d1187767c7263cef66764 (diff)
parent9ddc3da29fd0a5234b1ad318a85c912017cfbd91 (diff)
Merge pull request #1147 from murgatroid99/php_composer
Add composer package information to PHP library
-rw-r--r--src/php/composer.json15
-rw-r--r--src/php/composer.lock19
-rw-r--r--src/php/lib/Grpc/AbstractCall.php2
-rwxr-xr-xsrc/php/lib/Grpc/BaseStub.php1
-rw-r--r--src/php/lib/Grpc/BidiStreamingCall.php1
-rw-r--r--src/php/lib/Grpc/ClientStreamingCall.php1
-rw-r--r--src/php/lib/Grpc/ServerStreamingCall.php2
-rw-r--r--src/php/lib/Grpc/UnaryCall.php2
-rwxr-xr-xsrc/php/lib/autoload.php53
-rwxr-xr-xsrc/php/tests/generated_code/GeneratedCodeTest.php2
-rwxr-xr-xsrc/php/tests/interop/interop_client.php2
11 files changed, 36 insertions, 64 deletions
diff --git a/src/php/composer.json b/src/php/composer.json
new file mode 100644
index 0000000000..dca61a9889
--- /dev/null
+++ b/src/php/composer.json
@@ -0,0 +1,15 @@
+{
+ "name": "grpc/grpc",
+ "description": "gRPC library for PHP",
+ "version": "0.2.0",
+ "homepage": "http://grpc.io",
+ "license": "BSD-3-Clause",
+ "require": {
+ "php": ">=5.5.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "Grpc\\": "lib/Grpc/"
+ }
+ }
+}
diff --git a/src/php/composer.lock b/src/php/composer.lock
new file mode 100644
index 0000000000..47fc70fd2d
--- /dev/null
+++ b/src/php/composer.lock
@@ -0,0 +1,19 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
+ "This file is @generated automatically"
+ ],
+ "hash": "65467a098f5fd8b8fe5f7f6e10226f8a",
+ "packages": [],
+ "packages-dev": [],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": {
+ "php": ">=5.5.0"
+ },
+ "platform-dev": []
+}
diff --git a/src/php/lib/Grpc/AbstractCall.php b/src/php/lib/Grpc/AbstractCall.php
index b813d16470..d81df97067 100644
--- a/src/php/lib/Grpc/AbstractCall.php
+++ b/src/php/lib/Grpc/AbstractCall.php
@@ -33,8 +33,6 @@
*/
namespace Grpc;
-require_once realpath(dirname(__FILE__) . '/../autoload.php');
-
abstract class AbstractCall {
protected $call;
diff --git a/src/php/lib/Grpc/BaseStub.php b/src/php/lib/Grpc/BaseStub.php
index 9bc1711110..fc83dace20 100755
--- a/src/php/lib/Grpc/BaseStub.php
+++ b/src/php/lib/Grpc/BaseStub.php
@@ -32,7 +32,6 @@
*
*/
namespace Grpc;
-require_once realpath(dirname(__FILE__) . '/../autoload.php');
/**
* Base class for generated client stubs. Stub methods are expected to call
diff --git a/src/php/lib/Grpc/BidiStreamingCall.php b/src/php/lib/Grpc/BidiStreamingCall.php
index 0d3dd629f2..454f7621ae 100644
--- a/src/php/lib/Grpc/BidiStreamingCall.php
+++ b/src/php/lib/Grpc/BidiStreamingCall.php
@@ -32,7 +32,6 @@
*
*/
namespace Grpc;
-require_once realpath(dirname(__FILE__) . '/../autoload.php');
/**
* Represents an active call that allows for sending and recieving messages in
diff --git a/src/php/lib/Grpc/ClientStreamingCall.php b/src/php/lib/Grpc/ClientStreamingCall.php
index 4b3abcbdec..fa29037b42 100644
--- a/src/php/lib/Grpc/ClientStreamingCall.php
+++ b/src/php/lib/Grpc/ClientStreamingCall.php
@@ -32,7 +32,6 @@
*
*/
namespace Grpc;
-require_once realpath(dirname(__FILE__) . '/../autoload.php');
/**
* Represents an active call that sends a stream of messages and then gets a
diff --git a/src/php/lib/Grpc/ServerStreamingCall.php b/src/php/lib/Grpc/ServerStreamingCall.php
index 7458f28bcb..574c1bb1e0 100644
--- a/src/php/lib/Grpc/ServerStreamingCall.php
+++ b/src/php/lib/Grpc/ServerStreamingCall.php
@@ -33,8 +33,6 @@
*/
namespace Grpc;
-require_once realpath(dirname(__FILE__) . '/../autoload.php');
-
/**
* Represents an active call that sends a single message and then gets a stream
* of reponses
diff --git a/src/php/lib/Grpc/UnaryCall.php b/src/php/lib/Grpc/UnaryCall.php
index bbf9cfb588..814d477697 100644
--- a/src/php/lib/Grpc/UnaryCall.php
+++ b/src/php/lib/Grpc/UnaryCall.php
@@ -33,8 +33,6 @@
*/
namespace Grpc;
-require_once realpath(dirname(__FILE__) . '/../autoload.php');
-
/**
* Represents an active call that sends a single message and then gets a single
* response.
diff --git a/src/php/lib/autoload.php b/src/php/lib/autoload.php
deleted file mode 100755
index 42eb33d65b..0000000000
--- a/src/php/lib/autoload.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-function grpcAutoloader($class) {
- $prefix = 'Grpc\\';
-
- $base_dir = __DIR__ . '/Grpc/';
-
- $len = strlen($prefix);
- if (strncmp($prefix, $class, $len) !== 0) {
- return;
- }
-
- $relative_class = substr($class, $len);
-
- $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
-
- if (file_exists($file)) {
- include $file;
- }
-}
-
-spl_autoload_register('grpcAutoloader');
diff --git a/src/php/tests/generated_code/GeneratedCodeTest.php b/src/php/tests/generated_code/GeneratedCodeTest.php
index cb2c0e6d10..afd7f21de4 100755
--- a/src/php/tests/generated_code/GeneratedCodeTest.php
+++ b/src/php/tests/generated_code/GeneratedCodeTest.php
@@ -31,7 +31,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
-require_once realpath(dirname(__FILE__) . '/../../lib/autoload.php');
+require_once realpath(dirname(__FILE__) . '/../../vendor/autoload.php');
require 'DrSlump/Protobuf.php';
\DrSlump\Protobuf::autoload();
require 'math.php';
diff --git a/src/php/tests/interop/interop_client.php b/src/php/tests/interop/interop_client.php
index 7ee089e241..873fa00b82 100755
--- a/src/php/tests/interop/interop_client.php
+++ b/src/php/tests/interop/interop_client.php
@@ -31,7 +31,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
-require_once realpath(dirname(__FILE__) . '/../../lib/autoload.php');
+require_once realpath(dirname(__FILE__) . '/../../vendor/autoload.php');
require 'DrSlump/Protobuf.php';
\DrSlump\Protobuf::autoload();
require 'empty.php';