You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 24, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+32-29Lines changed: 32 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -4,16 +4,16 @@
4
4
> WARNING: As of now, this is a pre-release partial implementation.
5
5
> See the [Milestone Plan](https://github.com/sphereio/sphere-php-sdk/milestones?direction=desc&sort=completeness&state=open) for details of what's planned. We love feedback and [Issue reports](https://github.com/sphereio/sphere-php-sdk/issues?q=is%3Aopen+is%3Aissue+sort%3Acreated-asc)!
The PHP SDK allows developers to build applications on the SPHERE.IO REST API using PHP native interfaces, models and helpers instead of manually using the HTTP and JSON API. Users gain lots of IDE Auto-Completion and type checks on a literal API.
10
-
It also manages the OAuth2 security, provides caches and an interface for concurrent and asynchronous API calls.
The PHP SDK allows developers to build applications on the SPHERE.IO REST API using PHP native interfaces, models and helpers instead of manually using the HTTP and JSON API. Users gain lots of IDE Auto-Completion and type checks on a literal API.
10
+
It also manages the OAuth2 security, provides caches and an interface for concurrent and asynchronous API calls.
11
11
12
12
The SDK is licensed under the permissive [MIT License](LICENSE). Don't hesitate to [contribute](#contribute)!
13
13
14
14
## Install / Integrate into your Project
15
15
16
-
The SDK requires a PHP version of 5.4 or higher with the apc(u) PHP extension for its default cache. If you provide an own Cache interface, apc(u) is not necessary. The curl extension is recommended but not strictly necessary because the SDK is using the [Guzzle library](https://github.com/guzzle/guzzle) library, which falls back to PHP stream wrappers if curl is not available.
16
+
The SDK requires a PHP version of 5.4 or higher with the apc(u) PHP extension for its default cache. If you provide an own Cache interface, apc(u) is not necessary. The curl extension is recommended but not strictly necessary because the SDK is using the [Guzzle library](https://github.com/guzzle/guzzle) library, which falls back to PHP stream wrappers if curl is not available.
17
17
18
18
The recommended way to install the SDK is through [Composer](http://getcomposer.org).
19
19
@@ -34,23 +34,29 @@ After installing, you need to require Composer's autoloader if that's not yet th
34
34
require 'vendor/autoload.php';
35
35
```
36
36
37
-
If you don't use Composer, just [download a zip archive](archive/master.zip) of the latest release, manually integrate it and configure your own autoloader.
37
+
If you don't use Composer, just [download a zip archive](archive/master.zip) of the latest release, manually integrate it and configure your own autoloader.
38
38
39
-
Until the 1.0.0 release M0, M1 etc. milestone releases can contain incompatible changes. From 1.0.0 on, the project will follow the [semantic versioning](http://semver.org) guidelines, i.e. everything but major version changes are backwards-compatible. This matches composer's default behavior.
39
+
Until the 1.0.0 release M0, M1 etc. milestone releases can contain incompatible changes. From 1.0.0 on, the project will follow the [semantic versioning](http://semver.org) guidelines, i.e. everything but major version changes are backwards-compatible. This matches composer's default behavior.
40
40
41
-
With composer just run `composer update sphere/php-sdk` to update to compatible versions. Edit your `composer.json` file to update to incompatible versions.
41
+
With composer just run `composer update sphere/php-sdk` to update to compatible versions. Edit your `composer.json` file to update to incompatible versions.
42
42
43
-
Please read the [Changelog](CHANGELOG.md) before updating in any case.
43
+
Please read the [Changelog](CHANGELOG.md) before updating in any case.
44
44
45
45
## Use the SDK
46
46
47
-
To get up and running, [create a free test project](http://admin.sphere.io) to get a SPHERE project with API credentials (Menu "Developers"->"API Clients").
47
+
To get up and running, [create a free test project](http://admin.sphere.io) to get a SPHERE project with API credentials (Menu "Developers"->"API Clients").
48
48
49
49
```php
50
50
<?php
51
+
52
+
require '../vendor/autoload.php';
53
+
54
+
use Sphere\Core\Request\Products\ProductsSearchRequest;
In real world, you will not put your API credentials directly into code but use a config file or your framework's config or dependency injection system for that.
80
+
In real world, you will not put your API credentials directly into code but use a config file or your framework's config or dependency injection system for that.
76
81
77
-
The [API documentation](http://sphereio.github.io/sphere-php-sdk/docs/master) provides all the details you need in a searchable form.
82
+
The [API documentation](http://sphereio.github.io/sphere-php-sdk/docs/master) provides all the details you need in a searchable form.
78
83
79
84
## Develop and Improve
80
85
81
-
prepare your development environment (if necessary).
86
+
prepare your development environment (if necessary).
82
87
83
88
Mac OS X, assuming [Homebrew](http://brew.sh) is installed, do the following:
Linux users install php 5.4+, apc(u), xdebug and ant according to their distro's package system.
105
+
Linux users install php 5.4+, apc(u), xdebug and ant according to their distro's package system.
101
106
102
107
Clone the develop branch of the repository (we're using the [gitflow](http://nvie.com/posts/a-successful-git-branching-model/) branching model, so master is for releases only):
Please follow the [PSR-2](http://www.php-fig.org/psr/psr-2/) coding style, ideally via your IDE settings (see below for phpStorm instructions).
113
+
Please follow the [PSR-2](http://www.php-fig.org/psr/psr-2/) coding style, ideally via your IDE settings (see below for phpStorm instructions).
109
114
110
115
Please make sure that exiting Unit and Integration tests don't fail and fully cover your new code with Unit Tests. You can run all tests locally:
111
116
@@ -119,14 +124,12 @@ You can use the `docroot` directory with the built-in PHP web server. Add to the
119
124
120
125
```ini
121
126
[sphere]
122
-
oauth_url = 'https://auth.sphere.io/oauth/token'
123
-
api_url = 'https://api.sphere.io'
124
127
client_id = 'my client id'
125
128
client_secret = 'my client secret'
126
129
project = 'my project id'
127
130
```
128
131
129
-
Then activate the php builtin web server
132
+
Then activate the php builtin web server
130
133
131
134
```sh
132
135
cd<project_folder>
@@ -143,14 +146,14 @@ Now you can enable at Preferences > Editor > Inspections > PHP the "PHP code sni
143
146
144
147
## <aname="contribute"></a>Contribute
145
148
146
-
On bigger effort changes, please open a GitHub [issue](issues) and ask if you can help or get help with your idea. For typos and documentation improvements just make a pull request.
149
+
On bigger effort changes, please open a GitHub [issue](issues) and ask if you can help or get help with your idea. For typos and documentation improvements just make a pull request.
147
150
148
151
Then:
149
152
150
153
1. fork the repository on GitHub
151
154
2. code and add tests that cover the created code. Your code should be warning-free.
152
-
3. stick to PSR-2 and and don't reformat existing code.
153
-
4. make a pull request. @ct-jensschulze will review it and pull or come back to you.
155
+
3. stick to PSR-2 and and don't reformat existing code.
156
+
4. make a pull request. @ct-jensschulze will review it and pull or come back to you.
0 commit comments