Download the PHP package parse/php-sdk without Composer

On this page you can find all versions of the php package parse/php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-sdk

parse-repository-header-sdk-php


Build Status CI release Snyk Badge Coverage auto-release

PHP Version

packagist latest version

Backers on Open Collective Sponsors on Open Collective Forum Twitter


A library that gives you access to the powerful Parse Server backend from your PHP app. For more information on Parse and its features, see the website, the PHP guide, the Cloud Code guide or API Reference.


Table of Contents

Compatibility

The Parse PHP SDK is continuously tested with the most recent releases of PHP to ensure compatibility. We follow the PHP Long Term Support plan and only test against versions that are officially supported and have not reached their end-of-life date.

Version End-of-Life Compatible
PHP 8.2 Dec 2024 ✅ Yes
PHP 8.1 Nov 2023 ✅ Yes

Installation

There are various ways to install and use this sdk. We'll elaborate on a couple here. Note that the Parse PHP SDK requires PHP 5.4 or newer. It can also run on HHVM (recommended 3.0 or newer).

Install with Composer

Get Composer, the PHP package manager. Then create a composer.json file in your projects root folder, containing:

Run "composer install" to download the SDK and set up the autoloader, and then require it from your PHP script:

Install with Git

You can clone down this sdk using your favorite github client, or via the terminal.

You can then include the file in your code to automatically load the Parse SDK classes.

Install with another method

If you downloaded this sdk using any other means you can treat it like you used the git method above. Once it's installed you need only require the autoload.php to have access to the sdk.

Setup

Once you have access to the sdk you'll need to set it up in order to begin working with parse-server.

Initializing

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

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

Server URL

Directly after initializing the sdk you should set the server url.

Notice Parse server's default port is 1337 and the second parameter parse is the route prefix of your parse server.

For example if your parse server's url is http://example.com:1337/parse then you can set the server url using the following snippet

Server Health Check

To verify that the server url and mount path you've provided are correct you can run a health check on your server.

If you wanted to analyze it further the health response may look something like this.

The 'status' being the http response code, and the 'response' containing what the server replies with. Any additional details in the reply can be found under 'response', and you can use them to check and determine the availability of parse-server before you make requests.

Note that it is not guaranteed that 'response' will be a parsable json array. If the response cannot be decoded it will be returned as a string instead.

A couple examples of bad health responses could include an incorrect mount path, port or domain.

Keep in mind error & error_message may change depending on whether you are using the curl (may change across versions of curl) or stream client.

Http Clients

This SDK has the ability to change the underlying http client at your convenience. 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.

Setting the http client can be done as follows:

If you have a need for an additional http client you can request one by opening an issue or by submitting a PR.

If you wish to build one yourself make sure your http client implements 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.

Alternate CA File

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.

If this is the case you may need to specify a Certificate Authority bundle. You can download such a bundle from http://curl.haxx.se/ca/cacert.pem to use for this purpose. This one happens to be a Mozilla CA certificate store, you don't necessarily have to use this one but it's recommended.

Once you have your bundle you can set it as follows:

Getting Started

We highly recommend you read through the 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.

If want to know more about what makes the php sdk tick you can read our API Reference and flip through the code on github.

Check out the Parse PHP Guide for the full documentation.

Use Declarations

Add the "use" declarations where you'll be using the classes. For all of the sample code in this file:

Parse Objects

Parse Objects hold your data, can be saved, queried for, serialized and more! 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.

Users

Users are a special kind of object. This class allows individuals to access your applications with their unique information and allows you to identify them distinctly. Users may also be linked with 3rd party accounts such as facebook, twitter, etc.

Session Id and Session Fixation

In an attempt to avoid session fixation exploits, the PHP SDK will call session_regenerate_id() when a session's permissions are elevated (since 1.5.0). In practice this means that session_regenerate_id() will be called when a session goes from no user to anonymous user or from no user / anonymous user to registered user.

Changing the PHP session id should have no impact on the contents of the session and state should be maintained for a user that was anonymous and becomes registered.

Verification Emails

If you are using email verification in your parse server setup you can request to send verification emails by hand.

Note that this will only send if the account for the email requested has not already been verified.

ACLs

Access Control Lists (ACLs) allow you to granularly control access to individual Parse Objects. ACLs allow you to configure access to the general public, roles, and individual users themselves.

Queries

Queries allow you to recall objects that you've saved to parse-server. 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.

Aggregate

Queries can be made using aggregates, allowing you to retrieve objects over a set of input values. Keep in mind that _id does not exist in parse-server. Please replace with objectId. MasterKey is Required

For a list of available operators please refer to Mongo Aggregate Documentation.

Mongo 3.2 Aggregate Operators

Distinct

Queries can be made using distinct, allowing you find unique values for a specified field. Keep in mind that MasterKey is required.

Relative Time

Queries can be made using relative time, allowing you to retrieve objects over a varying ranges of relative dates. Keep in mind that all relative queries are performed using the server's time and timezone.

Cloud Functions

Directly call server-side cloud functions and get their results.

Cloud Jobs

Like cloud functions, cloud jobs allow you to run code server-side but in an asynchronous fashion. Instead of waiting for execution to complete you are immediately returned an id for tracking the job's progress. You can use this id to see the current information on a job and whether it has completed.

Config

ParseConfig allows you to access the global Config object for your parse server setup. You can get, set and update simple values much like you would on an instance of ParseObject. Through this all your SDKs and applications can have access to global settings, options, and more. What you choose to put in your config is purely up to you however.

Analytics

A specialized Parse Object built purposely to make analytics easy.

Files

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.

Push

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.

In order to use Push you must first configure a working push configuration in your parse server instance.

Push to Channels

You can send push notifications to any channels that you've created for your users.

Push with Query

You can also push to devices using queries targeting the ParseInstallation class.

Push with Audience

If you want to keep track of your sends when using queries you can use the ParseAudience class. You can create and configure your Audience objects with a name and query. When you indicate it's being used in a push the lastUsed and timesUsed values are updated for you.

Audiences provide you with a convenient way to group your queries and keep track of how often and when you send to them.

Push Status

If your server supports it you can extract and check the current status of your pushes. This allows you to monitor the success of your pushes in real time.

Server Info

Any server version 2.1.4 or later supports access to detailed information about itself and it's capabilities. You can leverage ParseServerInfo to check on the features and version of your server.

Version

Get the current version of the server you are connected to.

Features

Check which features your server has and how they are configured.

You can get details on the following features as well:

Schema

Direct manipulation of the classes that are on your server is possible through ParseSchema. Although fields and classes can be automatically generated (the latter assuming client class creation is enabled) ParseSchema gives you explicit control over these classes and their fields.

Assuming you want to remove a field you can simply call deleteField and save/update to clear it out.

A schema can be removed via delete, but it must be empty first.

Index

Indexes support efficient execution of queries from the database. MasterKey is required.

Purge

All objects can be purged from a schema (class) via purge. But be careful! This can be considered an irreversible action. Only do this if you really need to delete all objects from a class, such as when you need to delete the class (as in the code example above).

Logs

ParseLogs allows info and error logs to be retrieved from the server as JSON. Using the same approach as that which is utilized in the dashboard you can view your logs with specific ranges in time, type and order. Note that this requires the correct masterKey to be set during your initialization for access.

Contributing / Testing

See CONTRIBUTING for information on testing and contributing to the Parse PHP SDK.


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.


All versions of php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1 <8.4
ext-curl Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package parse/php-sdk contains the following files

Loading the files please wait ....