=================
|serviceFullName|
=================

This guide focuses on the AWS SDK for PHP interface to {{ serviceFullName }}. This guide assumes that you have already
downloaded and installed the AWS SDK for PHP 2. See :doc:`installation` for more information on getting started. To
learn more about {{ serviceFullName }}, please visit the service's `documentation website`_.

Creating a client
-----------------

The first thing you need to do is create a client object. There are a couple of ways to do this using the SDK.

Factory method
~~~~~~~~~~~~~~

The easiest way to get up and running is to use the factory method. Simply pass in your access keys and a region to
connect to.

.. code-block:: php

    use Aws\{{namespace}}\{{namespace}}Client;

    {% if not globalEndpoint -%}
    $client = {{namespace}}Client::factory(array(
        'key'    => '<aws access key>',
        'secret' => '<aws secret key>',
        'region' => '<{{ regions|join("|") }}>'
    ));{% else %}$client = {{namespace}}Client::factory(array(
        'key'    => '<aws access key>',
        'secret' => '<aws secret key>'
    ));
    {% endif %}

Service locator
~~~~~~~~~~~~~~~

A more robust way to connect to {{ serviceFullName }} is through the service locator. This allows you to specify
credentials and other configuration settings in a configuration file. These settings can then be shared across all
clients so that you only have to specify your keys once.

.. code-block:: php

    use Aws\Common\Aws;

    // Create a service builder using a configuration file
    $aws = Aws::factory('/path/to/my_config.json');

    // Get the {{ serviceFullName }} client by its short name
    $client = $aws->get('{{ locator_name }}');

    // You can also get the client by namespace
    $client = $aws->get('{{ namespace }}');

.. _`documentation website`: {{ doc_url }}
