diff options
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | examples/example.php | 13 | ||||
-rw-r--r-- | test/unit/bootstrap.php | 4 |
3 files changed, 14 insertions, 9 deletions
@@ -40,7 +40,7 @@ Add php-http-client to your `composer.json` file. If you are not using [Composer ```json { "require": { - "sendgrid/php-http-client": "~1" + "sendgrid/php-http-client": "1.*" } } ``` @@ -67,8 +67,8 @@ Following is an abridged example, here is the [full working code](https://github ```php <?php -include 'php-http-client'; -$config = new SendGrid\Config(dirname(__DIR__), '.env'); +require __DIR__ . '/vendor/autoload.php'; +$config = new SendGrid\Config(getcwd(), '.env'); $api_key = getenv('SENDGRID_API_KEY'); $headers = array( 'Content-Type: application/json', diff --git a/examples/example.php b/examples/example.php index 3a90c69..abf2e62 100644 --- a/examples/example.php +++ b/examples/example.php @@ -1,13 +1,18 @@ <?php -include(dirname(__DIR__).'/lib/client.php'); -include(dirname(__DIR__).'/lib/config.php'); -$config = new SendGrid\Config(dirname(__DIR__), '.env'); +// If running this outside of this context, use the following include and +// comment out the two includes below +// require __DIR__ . '/vendor/autoload.php'; +include(dirname(__DIR__).'/lib/SendGrid/client.php'); +include(dirname(__DIR__).'/lib/SendGrid/config.php'); +// This gets the parent directory, for your current directory use getcwd() +$path_to_config = dirname(__DIR__); +$config = new SendGrid\Config($path_to_config, '.env'); $api_key = getenv('SENDGRID_API_KEY'); $headers = array( 'Content-Type: application/json', 'Authorization: Bearer '.$api_key ); -$client = new SendGrid\Client('https://e9sk3d3bfaikbpdq7.stoplight-proxy.io', $headers, '/v3', null); +$client = new SendGrid\Client('https://api.sendgrid.com', $headers, '/v3', null); // GET Collection $query_params = array('limit' => 100, 'offset' => 0); diff --git a/test/unit/bootstrap.php b/test/unit/bootstrap.php index 8b4e24a..e0da9a5 100644 --- a/test/unit/bootstrap.php +++ b/test/unit/bootstrap.php @@ -1,6 +1,6 @@ <?php -include(dirname(dirname(__FILE__)) . '/../lib/client.php'); -include(dirname(dirname(__FILE__)) . '/../lib/config.php'); +include(dirname(dirname(__FILE__)) . '/../lib/SendGrid/client.php'); +include(dirname(dirname(__FILE__)) . '/../lib/SendGrid/config.php'); require __DIR__ . '/../../vendor/autoload.php'; function autoload_tests($class) { |