[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 .. Services_Twilio documentation master file, created by 2 sphinx-quickstart on Tue Mar 8 04:02:01 2011. 3 You can adapt this file completely to your liking, but it should at least 4 contain the root `toctree` directive. 5 6 ================= 7 **twilio-php** 8 ================= 9 10 Status 11 ======= 12 13 This documentation is for version 3.12.2 of `twilio-php 14 <https://www.github.com/twilio/twilio-php>`_. 15 16 Quickstart 17 ============ 18 19 Send an SMS 20 >>>>>>>>>>> 21 22 .. code-block:: php 23 24 // Download the library and copy into the folder containing this file. 25 require('/path/to/twilio-php/Services/Twilio.php'); 26 27 $account_sid = "ACXXXXXX"; // Your Twilio account sid 28 $auth_token = "YYYYYY"; // Your Twilio auth token 29 30 $client = new Services_Twilio($account_sid, $auth_token); 31 $message = $client->account->messages->sendMessage( 32 '+14085551234', // From a Twilio number in your account 33 '+12125551234', // Text any number 34 "Hello monkey!" 35 ); 36 37 print $message->sid; 38 39 Make a Call 40 >>>>>>>>>>>>>> 41 42 .. code-block:: php 43 44 // Download the library and copy into the folder containing this file. 45 require('/path/to/twilio-php/Services/Twilio.php'); 46 47 $account_sid = "ACXXXXXX"; // Your Twilio account sid 48 $auth_token = "YYYYYY"; // Your Twilio auth token 49 50 $client = new Services_Twilio($account_sid, $auth_token); 51 $call = $client->account->calls->create( 52 '+14085551234', // From a Twilio number in your account 53 '+12125551234', // Call any number 54 55 // Read TwiML at this URL when a call connects (hold music) 56 'http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient' 57 ); 58 59 Generating TwiML 60 >>>>>>>>>>>>>>>> 61 62 To control phone calls, your application needs to output `TwiML 63 <http://www.twilio.com/docs/api/twiml/>`_. Use :class:`Services_Twilio_Twiml` 64 to easily create such responses. 65 66 .. code-block:: php 67 68 $response = new Services_Twilio_Twiml(); 69 $response->say('Hello'); 70 $response->play('https://api.twilio.com/cowbell.mp3', array("loop" => 5)); 71 print $response; 72 73 .. code-block:: xml 74 75 <?xml version="1.0" encoding="utf-8"?> 76 <Response> 77 <Say>Hello</Say> 78 <Play loop="5">https://api.twilio.com/cowbell.mp3</Play> 79 </Response> 80 81 View more examples of TwiML generation here: :ref:`usage-twiml` 82 83 Installation 84 ============ 85 86 There are two ways to install **twilio-php**: via the PEAR installer, or by 87 downloading the source. 88 89 Via PEAR 90 >>>>>>>>>>>>> 91 92 Use the ``Makefile`` in the repo's top 93 94 .. code-block:: bash 95 96 pear channel-discover twilio.github.com/pear 97 pear install twilio/Services_Twilio 98 99 From Source 100 >>>>>>>>>>>>> 101 102 If you aren't using PEAR, download the `source (.zip) 103 <https://github.com/twilio/twilio-php/zipball/master>`_, which includes all the 104 dependencies. 105 106 User Guide 107 ================== 108 109 REST API 110 >>>>>>>>>> 111 112 .. toctree:: 113 :maxdepth: 2 114 :glob: 115 116 usage/rest 117 usage/rest/* 118 119 TwiML and other utilities 120 >>>>>>>>>>>>>>>>>>>>>>>>>> 121 122 .. toctree:: 123 :maxdepth: 1 124 125 usage/twiml 126 usage/validation 127 usage/token-generation 128 faq/ 129 130 API Documentation 131 ================== 132 133 .. toctree:: 134 :maxdepth: 3 135 :glob: 136 137 api/* 138 139 140 Support and Development 141 =========================== 142 143 All development occurs on `Github <https://github.com/twilio/twilio-php>`_. To 144 check out the source, run 145 146 .. code-block:: bash 147 148 git clone [email protected]:twilio/twilio-php.git 149 150 Report bugs using the Github `issue tracker <https://github.com/twilio/twilio-php/issues>`_. 151 152 If you've got questions that aren't answered by this documentation, ask the 153 Twilio support team at [email protected]. 154 155 Running the Tests 156 >>>>>>>>>>>>>>>>>>>>>>>>> 157 158 The unit tests depend on `Mockery <https://github.com/padraic/mockery>`_ and 159 `PHPUnit <https://github.com/sebastianbergmann/phpunit>`_. First, 'discover' all 160 the necessary `PEAR` channels: 161 162 .. code-block:: bash 163 164 make test-install 165 166 After installation, run the tests with :data:`make`. 167 168 .. code-block:: bash 169 170 make test 171 172 173 Making the Documentation 174 >>>>>>>>>>>>>>>>>>>>>>>>>> 175 176 Our documentation is written using `Sphinx <http://sphinx.pocoo.org/>`_. You'll 177 need to install Sphinx and the Sphinx PHP domain before you can build the docs. 178 179 .. code-block:: bash 180 181 make docs-install 182 183 Once you have those installed, making the docs is easy. 184 185 .. code-block:: bash 186 187 make docs 188
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |