Download the PHP package playable-cn/forrest without Composer

On this page you can find all versions of the php package playable-cn/forrest. 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 forrest

Salesforce REST API Client for Laravel

Laravel Latest Stable Version Total Downloads License Build Status

Salesforce/Force.com REST API client for Laravel. While it acts as more of a wrapper of the API methods, it should provide you with all the flexibility you will need to interact with the REST service.

Currently the only support is for Laravel and Lumen.

Interested in Eloquent Salesforce Models? Check out @roblesterjr04's EloquentSalesForce project that utilizes Forrest as it's API layer.

Installation

If you are upgrading to Version 2.0, be sure to re-publish your config file.

Forrest can be installed through composer. Open your composer.json file and add the following to the require key:

Next run composer update from the command line to install the package.

Laravel Installation

Add the service provider and alias to your config/app.php file:

For Laravel 4, add Omniphx\Forrest\Providers\Laravel4\ForrestServiceProvider in app/config/app.php. Alias will remain the same.

Lumen Installation

Then you'll utilize the Lumen service provider by registering it in the bootstrap/app.php file.

Configuration

You will need a configuration file to add your credentials. Publish a config file using the artisan command:

This will publish a config/forrest.php file that can switch between authentication types as well as other settings.

After adding the config file, update your .env to include the following values (details for getting a consumer key and secret are outlined below):

For Lumen, you should copy the config file from src/config/config.php and add it to a forrest.php configuration file under a config directory in the root of your application.

For Laravel 4, run php artisan config:publish omniphx/forrest which create app/config/omniphx/forrest/config.php

Getting Started

Setting up a Connected App

  1. Log into to your Salesforce org
  2. Click on Setup in the upper right-hand menu
  3. Under Build click Create > Apps
  4. Scroll to the bottom and click New under Connected Apps.
  5. Enter the following details for the remote application:
    • Connected App Name
    • API Name
    • Contact Email
    • Enable OAuth Settings under the API dropdown
    • Callback URL
    • Select access scope (If you need a refresh token, specify it here)
  6. Click Save

After saving, you will now be given a Consumer Key and Consumer Secret. Update your config file with values for consumerKey, consumerSecret, loginURL and callbackURI.

Setup

Creating authentication routes

Web Server authentication flow
Username-Password authentication flow

With the Username Password flow, you can directly authenticate with the Forrest::authenticate() method.

To use this authentication you must add your username, and password to the config file. Security token might need to be ammended to your password unless your IP address is whitelisted.

SOAP authentication flow

(When you cannot create a connected App in Salesforce)

  1. Salesforce allows individual logins via a SOAP Login
  2. The Bearer access token returned from the SOAP login can be used similar to Oauth key
  3. Update your config file and set the authentication value to UserPasswordSoap
  4. Update your config file with values for loginURL, username, and password. With the Username Password SOAP flow, you can directly authenticate with the Forrest::authenticate() method.

To use this authentication you can add your username, and password to the config file. Security token might need to be ammended to your password unless your IP address is whitelisted.

If your application requires logging in to salesforce as different users, you can alternatively pass in the login url, username, and password to the Forrest::authenticateUser() method.

Security token might need to be ammended to your password unless your IP address is whitelisted.

Custom login urls

Sometimes users will need to connect to a sandbox or custom url. To do this, simply pass the url as an argument for the authenticatation method:

Note: You can specify a default login URL in your config file.

Basic usage

After authentication, your app will store an encrypted authentication token which can be used to make API requests.

Query a record

Sample result:

If you are querying more than 2000 records, you response will include:

Simply, call Forrest::next($nextRecordsUrl) to return the next 2000 records.

Create a new record

Records can be created using the following format.

Update a record

Update a record with the PUT method.

Upsert a record

Update a record with the PATCH method and if the external Id doesn't exist, it will insert a new record.

Delete a record

Delete a record with the DELETE method.

Setting headers

Sometimes you need the ability to set custom headers (e.g., creating a Lead with an assignment rule)

To disable assignment rules, use 'Sforce-Auto-Assign' => 'false'

XML format

Change the request/response format to XML with the format key or make it default in your config file.

API Requests

With the exception of the search and query resources, all resources are requested dynamically using method overloading.

You can determine which resources you have access to by calling with the resource method

This sample output shows the resourses available to call via the API:

From the list above, I can call resources by referring to the specified key.

Or...

Additional resource url parameters can also be passed in

As well as new formatting options, headers or other configurations

Upsert multiple records (Bulk API 2.0)

Bulk API requests are especially handy when you need to quickly load large amounts of data into your Salesforce org. The key differences is that it requires at least three separate requests (Create, Add, Close), and the data being loaded is sent in a CSV format.

To illustrate, following are three requests to upsert a CSV of Contacts records.

Create

Create a bulk upload job with the POST method, the body contains the following job properties:

We're storing the response in $bulkJob in order to reference the unique Job ID in the Add and Close requests below.

See Create a Job for the full list of options available here.

Add Data

Using the Job ID from the Create POST request, you then send the CSV data to be processed using a PUT request. This assumes you've loaded your CSV contents to $csv

See Prepare CSV Files for details on how it should be formatted.

Close

You must close the job before the records can be processed, to do so you send an UploadComplete state using a PATCH request to the Job ID.

See Close or Abort a Job for more options and details on how to abort a job.

Bulk API 2.0 is available in API version 41.0 and later. For more information on Salesforce Bulk API, check out the official documentation and this tutorial on how to perform a successful Bulk Upload.

Additional API Requests

Refresh

If a refresh token is set, the server can refresh the access token on the user's behalf. Refresh tokens are only for the Web Server flow.

If you need a refresh token, be sure to specify this under access scope in your Connected App. You can also specify this in your configuration file by adding 'scope' => 'full refresh_token'. Setting scope access in the config file is optional, the default scope access is determined by your Salesforce org.

Revoke

This will revoke the authorization token. The session will continue to store a token, but it will become invalid.

Versions

Returns all currently supported versions. Includes the verison, label and link to each version's root:

Resources

Returns list of available resources based on the logged in user's permission and API version.

Identity

Returns information about the logged-in user.

For a complete listing of API resources, refer to the Force.com REST API Developer's Guide

Custom Apex endpoints

If you create a custom API using Apex, you can use the custom() method for consuming them.

Additional options and parameters can be passed in like this:

Read Creating REST APIs using Apex REST for more information.

Raw Requests

If needed, you can make raw requests to an endpoint of your choice.

Raw response output

By default, this package will return the body of a response as either a deserialized JSON object or a SimpleXMLElement object.

There might be times, when you would rather handle this differently. To do this, simply use any format other than 'json' or 'xml' and the code will return a Guzzle response object.

Event Listener

This package makes use of Guzzle's event listers

For more information about Guzzle responses and event listeners, refer to their documentation.


All versions of forrest with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
illuminate/cache Version >5
illuminate/contracts Version >5
illuminate/config Version >5
illuminate/http Version >5
illuminate/routing Version >5
guzzlehttp/guzzle Version >6.0
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 playable-cn/forrest contains the following files

Loading the files please wait ....