Skip to content

Commit 5b07e63

Browse files
authored
README & Code Cleanup, adds CHANGELOG & CODE_OF_CONDUCT
* Cleanup README * link corrections * fine changes on README * Removes autogenerated comments, corrects email * Added CHANGELOG * Added CODE_OF_CONDUCT * Code Cleanup in src/ * Code cleanup in tests/
1 parent c4ed8fd commit 5b07e63

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+555
-214
lines changed

CHANGELOG.md

Lines changed: 248 additions & 0 deletions
Large diffs are not rendered by default.

CODE_OF_CONDUCT.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
* Using welcoming and inclusive language
12+
* Being respectful of differing viewpoints and experiences
13+
* Gracefully accepting constructive criticism
14+
* Focusing on what is best for the community
15+
* Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
* Trolling, insulting/derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44+
45+
[homepage]: http://contributor-covenant.org
46+
[version]: http://contributor-covenant.org/version/1/4/

README.md

Lines changed: 135 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,44 @@
1-
Parse PHP SDK
2-
-------------
1+
# Parse PHP SDK
32

43
[![codecov](https://codecov.io/gh/parse-community/parse-php-sdk/branch/master/graph/badge.svg)](https://codecov.io/gh/parse-community/parse-php-sdk)
54
[![Build Status](https://travis-ci.org/parse-community/parse-php-sdk.svg?branch=master)](https://travis-ci.org/parse-community/parse-php-sdk)
65

76
The Parse PHP SDK gives you access to the powerful Parse cloud platform
8-
from your PHP app or script. Updated to work with the self-hosted Parse Server: https://github.com/parse-community/parse-server
9-
10-
Installation
11-
------------
7+
from your PHP app or script. Designed to work with the self-hosted Parse Server: https://github.com/parse-community/parse-server
8+
9+
## Table of Contents
10+
- [Installation](#installation)
11+
- [Install with Composer](#install-with-composer)
12+
- [Install with Git](#install-with-git)
13+
- [Install with another method](#install-with-another-method)
14+
- [Setup](#setup)
15+
- [Initializing](#initializing)
16+
- [Server URL](#server-url)
17+
- [Http Clients](#http-clients)
18+
- [Alternate CA files](#alternate-ca-file)
19+
- [Getting Started](#getting-started)
20+
- [Use Declarations](#use-declarations)
21+
- [Parse Objects](#parse-objects)
22+
- [Users](#users)
23+
- [ACLs/Security](#acls)
24+
- [Queries](#queries)
25+
- [Cloud Functions](#cloud-functions)
26+
- [Analytics](#analytics)
27+
- [Files](#files)
28+
- [Push Notifications](#push)
29+
- [Push to Channels](#push-to-channels)
30+
- [Push with Query](#push-with-query)
31+
- [Push Status](#push-status)
32+
- [Server Info](#server-info)
33+
- [Version](#version)
34+
- [Features](#features)
35+
- [Contributing / Testing](#contributing--testing)
36+
37+
## Installation
38+
There are various ways to install and use this sdk. We'll elaborate on a couple here.
39+
Note that the Parse PHP SDK requires PHP 5.4 or newer.
40+
41+
### Install with Composer
1242

1343
[Get Composer], the PHP package manager. Then create a composer.json file in
1444
your projects root folder, containing:
@@ -28,33 +58,47 @@ and then require it from your PHP script:
2858
require 'vendor/autoload.php';
2959
```
3060

31-
Note: The Parse PHP SDK requires PHP 5.4 or newer.
61+
### Install with Git
3262

33-
Alternative Method
34-
------------------
63+
You can clone down this sdk using your favorite github client, or via the terminal.
64+
```bash
65+
git clone https://github.com/parse-community/parse-php-sdk.git
66+
```
3567

36-
If you don't want to use Composer, you can include the ```autoload.php```
37-
file in your code to automatically load the Parse SDK classes.
68+
You can then include the ```autoload.php``` file in your code to automatically load the Parse SDK classes.
3869

3970
```php
4071
require 'autoload.php';
4172
```
4273

43-
Initialization
44-
---------------
74+
### Install with another method
75+
76+
If you downloaded this sdk using any other means you can treat it like you used the git method above.
77+
Once it's installed you need only require the `autoload.php` to have access to the sdk.
78+
79+
## Setup
80+
81+
Once you have access to the sdk you'll need to set it up in order to begin working with parse-server.
82+
83+
### Initializing
4584

4685
After including the required files from the SDK, you need to initialize the ParseClient using your Parse API keys:
4786

4887
```php
4988
ParseClient::initialize( $app_id, $rest_key, $master_key );
50-
// Users of Parse Server will need to point ParseClient at their remote URL and Mount Point:
51-
ParseClient::setServerURL('https://my-parse-server.com:port','parse');
5289
```
5390

5491
If your server does not use or require a REST key you may initialize the ParseClient as follows, safely omitting the REST key:
5592

5693
```php
5794
ParseClient::initialize( $app_id, null, $master_key );
95+
```
96+
97+
### Server URL
98+
99+
Directly after initializing the sdk you should set the server url.
100+
101+
```php
58102
// Users of Parse Server will need to point ParseClient at their remote URL and Mount Point:
59103
ParseClient::setServerURL('https://my-parse-server.com:port','parse');
60104
```
@@ -67,15 +111,7 @@ For example if your parse server's url is `http://example.com:1337/parse` then y
67111
ParseClient::setServerURL('https://example.com:1337','parse');
68112
```
69113

70-
Getting Started
71-
---------------
72-
73-
We highly recommend you read through the [guide](http://docs.parseplatform.org/php/guide/) first. This will walk you through the basics of working with this sdk, as well as provide insight into how to best develop your project.
74-
75-
If want to know more about what makes the php sdk tick you can read our [API Reference](http://parseplatform.org/parse-php-sdk/namespaces/Parse.html) and flip through the code on [github](https://github.com/parse-community/parse-php-sdk/).
76-
77-
Http Clients
78-
------------
114+
### Http Clients
79115

80116
This SDK has the ability to change the underlying http client at your convenience.
81117
The default is to use the curl http client if none is set, there is also a stream http client that can be used as well.
@@ -94,9 +130,7 @@ If you have a need for an additional http client you can request one by opening
94130

95131
If you wish to build one yourself make sure your http client implements ```ParseHttpable``` for it be compatible with the SDK. Once you have a working http client that enhances the SDK feel free to submit it in a PR so we can look into adding it in.
96132

97-
98-
Alternate Certificate Authority File
99-
------------------------------------
133+
### Alternate CA File
100134

101135
It is possible that your local setup may not be able to verify with peers over SSL/TLS. This may especially be the case if you do not have control over your local installation, such as for shared hosting.
102136

@@ -109,12 +143,16 @@ Once you have your bundle you can set it as follows:
109143
ParseClient::setCAFile(__DIR__ . '/certs/cacert.pem');
110144
```
111145

146+
## Getting Started
112147

113-
Usage
114-
-----
148+
We highly recommend you read through the [guide](http://docs.parseplatform.org/php/guide/) first. This will walk you through the basics of working with this sdk, as well as provide insight into how to best develop your project.
149+
150+
If want to know more about what makes the php sdk tick you can read our [API Reference](http://parseplatform.org/parse-php-sdk/namespaces/Parse.html) and flip through the code on [github](https://github.com/parse-community/parse-php-sdk/).
115151

116152
Check out the [Parse PHP Guide] for the full documentation.
117153

154+
### Use Declarations
155+
118156
Add the "use" declarations where you'll be using the classes. For all of the
119157
sample code in this file:
120158

@@ -130,9 +168,14 @@ use Parse\ParseAnalytics;
130168
use Parse\ParseFile;
131169
use Parse\ParseCloud;
132170
use Parse\ParseClient;
171+
use Parse\ParsePushStatus;
172+
use Parse\ParseServerInfo;
133173
```
134174

135-
Objects:
175+
### Parse Objects
176+
177+
Parse Objects hold your data, can be saved, queried for, serialized and more!
178+
Objects are at the core of this sdk, they allow you to persist your data from php without having to worry about any databasing code.
136179

137180
```php
138181
$object = ParseObject::create("TestObject");
@@ -160,7 +203,11 @@ $encoded = $object->encode();
160203
$decodedObject = ParseObject::decode($encoded);
161204
```
162205

163-
Users:
206+
### Users
207+
208+
Users are a special kind of object.
209+
This class allows individuals to access your applications with their unique information and allows you to identify them distinctly.
210+
Users may also be linked with 3rd party accounts such as facebook, twitter, etc.
164211

165212
```php
166213
// Signup
@@ -184,7 +231,10 @@ try {
184231
$user = ParseUser::getCurrentUser();
185232
```
186233

187-
Security:
234+
### ACLs
235+
236+
Access Control Lists (ACLs) allow you to granularly control access to individual Parse Objects.
237+
ACLs allow you to configure access to the general public, roles, and individual users themselves.
188238

189239
```php
190240
// Access only by the ParseUser in $user
@@ -201,7 +251,10 @@ $acl->setUserWriteAccess($user, true);
201251
$acl->setRoleWriteAccessWithName("PHPFans", true);
202252
```
203253

204-
Queries:
254+
### Queries
255+
256+
Queries allow you to recall objects that you've saved to parse-server.
257+
Query methods and parameters allow allow a varying degree of querying for objects, from all objects of a class to objects created within a particular date range and more.
205258

206259
```php
207260
$query = new ParseQuery("TestObject");
@@ -227,13 +280,17 @@ $query->each(function($obj) {
227280
});
228281
```
229282

230-
Cloud Functions:
283+
### Cloud Functions
284+
285+
Directly call server-side cloud coud functions and get their results.
231286

232287
```php
233288
$results = ParseCloud::run("aCloudFunction", array("from" => "php"));
234289
```
235290

236-
Analytics:
291+
### Analytics
292+
293+
A specialized Parse Object built purposely to make analytics easy.
237294

238295
```php
239296
ParseAnalytics::track("logoReaction", array(
@@ -242,7 +299,9 @@ ParseAnalytics::track("logoReaction", array(
242299
));
243300
```
244301

245-
Files:
302+
### Files
303+
304+
Persist files to parse-server and retrieve them at your convenience. Depending on how your server is setup there are a variety of storage options including mongodb, Amazon S3 and Google Cloud Storage. You can read more about that [here](https://github.com/parse-community/parse-server/#configuring-file-adapters).
246305

247306
```php
248307
// Get from a Parse Object:
@@ -261,10 +320,16 @@ $file = ParseFile::createFromFile(
261320
$file = ParseFile::createFromData($contents, "Parse.txt", "text/plain");
262321
```
263322

264-
Push:
323+
### Push
324+
325+
Push notifications can be constructed and sent using this sdk. You can send pushes to predefined channels of devices, or send to a customized set of devices using the power of `ParseQuery`.
265326

266327
In order to use Push you must first configure a [working push configuration](http://docs.parseplatform.org/parse-server/guide/#push-notifications) in your parse server instance.
267328

329+
#### Push to Channels
330+
331+
You can send push notifications to any channels that you've created for your users.
332+
268333
```php
269334
$data = array("alert" => "Hi!");
270335

@@ -278,8 +343,13 @@ ParsePush::send(array(
278343
"channels" => ["PHPFans"],
279344
"data" => $data
280345
), true);
346+
```
347+
348+
#### Push with Query
281349

350+
You can also push to devices using queries targeting the `ParseInstallation` class.
282351

352+
```php
283353
// Push to Query
284354
$query = ParseInstallation::query();
285355
$query->equalTo("design", "rad");
@@ -288,8 +358,14 @@ ParsePush::send(array(
288358
"where" => $query,
289359
"data" => $data
290360
), true);
361+
```
291362

363+
#### Push Status
292364

365+
If your server supports it you can extract and check the current status of your pushes.
366+
This allows you to monitor the success of your pushes in real time.
367+
368+
```php
293369
// Get Push Status
294370
$response = ParsePush::send(array(
295371
"channels" => ["StatusFans"],
@@ -328,9 +404,22 @@ if(ParsePush::hasStatus($response)) {
328404
}
329405
```
330406

331-
Server Info:
407+
### Server Info
408+
409+
Any server version **2.1.4** or later supports access to detailed information about itself and it's capabilities.
410+
You can leverage `ParseServerInfo` to check on the features and version of your server.
411+
412+
#### Version
413+
Get the current version of the server you are connected to.
414+
415+
```php
416+
// get the current version of the server you are connected to (2.6.5, 2.5.4, etc.)
417+
$version = ParseServerInfo::getVersion();
418+
```
419+
420+
#### Features
421+
Check which features your server has and how they are configured.
332422

333-
Get information regarding the configuration of the server you are connecting to.
334423
```php
335424
// get the current version of the server you are connected to (2.6.5, 2.5.4, etc.)
336425
$version = ParseServerInfo::getVersion();
@@ -346,6 +435,9 @@ $globalConfigFeatures = ParseServerInfo::getGlobalConfigFeatures();
346435
* "delete" : true
347436
* }
348437
*/
438+
439+
// you can always get all feature data
440+
$data = ParseServerInfo::getFeatures();
349441
```
350442

351443
You can get details on the following features as well:
@@ -362,15 +454,14 @@ $globalConfigFeatures = ParseServerInfo::getGlobalConfigFeatures();
362454

363455
```
364456

365-
Contributing / Testing
366-
----------------------
457+
## Contributing / Testing
367458

368459
See [CONTRIBUTING](CONTRIBUTING.md) for information on testing and contributing to
369460
the Parse PHP SDK. We welcome fixes and enhancements.
370461

371-
[Get Composer]: https://getcomposer.org/download/
372-
[Parse PHP Guide]: http://docs.parseplatform.org/php/guide/
373-
374462
-----
375463

376464
As of April 5, 2017, Parse, LLC has transferred this code to the parse-community organization, and will no longer be contributing to or distributing this code.
465+
466+
[Get Composer]: https://getcomposer.org/download/
467+
[Parse PHP Guide]: http://docs.parseplatform.org/php/guide/

src/Parse/HttpClients/ParseCurl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
* Class ParseCurl - Wrapper for abstracted curl usage
1212
*
13-
* @author Ben Friedman <ben@axolsoft.com>
13+
* @author Ben Friedman <friedman.benjamin@gmail.com>
1414
* @package Parse\HttpClients
1515
*/
1616
class ParseCurl

0 commit comments

Comments
 (0)