5 This piece of software is released under the terms of the following license:
9 Copyright (c) 2013-2019 XQueue GmbH
11 Permission is hereby granted, free of charge, to any person obtaining a copy
12 of this software and associated documentation files (the "Software"), to deal
13 in the Software without restriction, including without limitation the rights
14 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 copies of the Software, and to permit persons to whom the Software is
16 furnished to do so, subject to the following conditions:
18 The above copyright notice and this permission notice shall be included in
19 all copies or substantial portions of the Software.
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
31 Upon unpacking the distributed .zip file, you will see the following elements in the extracted folder:
33 client/ - the client code
34 doc/ - the API documentation
35 test/ - the testing app and the phphunit tests
36 CHANGELOG - The changelog file
37 LICENSE - a copy of the MIT license this software is released under
39 build.properties - the build configuration
40 build.xml - the ant build file
41 phpunit-configuration.xml - the phpunit configuration file
43 ## Accessing the documentation
45 Point your browser to `doc/index.html`.
47 ## Installing the tester application
49 You will need a web server with a working PHP installation. If you are developing on Windows, [XAMPP](https://www.apachefriends.org) is an easy way to provide such an environment.
51 Next, open `build.properties` in your favorite text editor. Adjust the build settings so that `dir.deploy` points somewhere into your webservers document directory (ignore the phpunit setting for now):
53 # point this to where you want to deploy the api tester
54 dir.deploy=C:\\xampp\\htdocs\\maileon-api-tester
56 # your phpunit executable
59 Now enter your Maileon API key inside the file `test/conf/config.include`.
61 For the next step, you will need a working installation of [Apache Ant](http://ant.apache.org/). Make sure to put the directory that contains the `ant` executable on your system's `PATH`.
63 Once ant is installed, run it inside the directory where you unpacked the API client:
65 C:\projects\maileon-php-client-0.10.3>ant
66 Buildfile: C:\projects\eagle_kunde\php-api-client\target\maileon-php-client-0.10.3\build.xml
69 [echo] [deploying project to C:\xampp\htdocs\maileon-api-tester]
74 Now, you should be able to access the tester app using your browser. Given the example configuration above, just point your Browser to [http://localhost/maileon-api-tester/](http://localhost/maileon-api-tester/).
76 To verify that your installation works, check all the checkboxes in the "Ping - Tests" section and click the button "Run tests" on the bottom of the page. In order to perform the other tests, you will have to look at the source code and adjust the input data to match the data that is available inside your account.
79 ## Installing the API client into your PHP application
81 Copy the entire `client` subdirectory to your webserver. Then, from the code that uses the client, include the client's main file:
83 // Include the Maileon API Client classloader
84 require_once('./client/MaileonApiClient.php');
86 You can rename the `client` subdirectory, as long as you also change the path in the `require_once` directive accordingly. You may also want to install a root certificate bundle to enable secure transmissions over HTTPS. See the last section "Connecting to the API using HTTPS" of this document for instructions on how to achieve this.
88 ## Running the PHPUnit tests
90 Download [PHPUnit](http://phpunit.de/) and put its executable on your `PATH`. If you're on a system other than Windows, adjust the name of the `phpunit` executable inside `build.properties`. Make sure that your Maileon API key is entered correctly inside the file `test/conf/config.include`.
92 Now run `ant test` inside the directory where you unzipped the distributable.
94 ## Connecting to the API using HTTPS
96 Since it is likely that you will be transmitting sensible customer data over the API, you should use the SSL-enabled API endpoint `https://api.maileon.com/1.0` instead of the plain HTTP version. In order to do so, you will have to install a root certificate bundle for cURL by following these steps:
98 1. Download the bundle from http://curl.haxx.se/ca/cacert.pem .
99 2. Copy the bundle to a directory that can be accessed by PHP.
100 3. Add the following entry to your php.ini (remember to change the path to where you put the cert bundle):
102 curl.cainfo="C:\xampp\php\cacert.pem"
104 You should now be able to connect to the SSL-enabled API endpoint.