<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PHP and Salesforce &#187; Sandbox</title>
	<atom:link href="http://phpandsalesforce.com/tag/sandbox/feed/" rel="self" type="application/rss+xml" />
	<link>http://phpandsalesforce.com</link>
	<description>A CRM Reference For PHP Developers</description>
	<lastBuildDate>Wed, 26 May 2010 22:19:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Welcome to PHP and Salesforce!</title>
		<link>http://phpandsalesforce.com/2009/06/16/welcome-to-php-and-salesforce/</link>
		<comments>http://phpandsalesforce.com/2009/06/16/welcome-to-php-and-salesforce/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 23:57:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Getting Started]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Salesforce]]></category>
		<category><![CDATA[Sandbox]]></category>
		<category><![CDATA[Toolkit]]></category>

		<guid isPermaLink="false">http://phpandsalesforce.com/?p=3</guid>
		<description><![CDATA[PHP and Salesforce is a new blog dedicated to helping web developers take control over their CRM integration.  Most of the early entries will focus on building a reference of Salesforce PHP examples, followed by discussions on topics including performance, concurrency, CRM framework architecture (and whether you should consider building one), and strategies for [...]]]></description>
			<content:encoded><![CDATA[<p>PHP and Salesforce is a new blog dedicated to helping web developers take control over their CRM integration.  Most of the early entries will focus on building a reference of Salesforce PHP examples, followed by discussions on topics including performance, concurrency, CRM framework architecture (and whether you should consider building one), and strategies for handling scheduled and unscheduled outages.</p>
<p>Before we go any further, <b>you must have either the Enterprise Edition or the Unlimited Edition</b> to access the API with your production Salesforce.com instance.  Those of you who are using the Group Edition or the Professional Edition can test your API code against the Developer Edition, by signing up <a href="http://www.developerforce.com/events/regular/registration.php">here</a>.  However, there is currently a limit of 5,000 API calls per 24 hour period in the Developer Edition.  </p>
<h3>Downloading The Toolkit</h3>
<p>Today, we&#8217;re going to walk through getting the PHP Toolkit set up and a sandbox copied off.  Let&#8217;s start by downloading the Toolkit:</p>
<ul>
<li><a href="http://wiki.developerforce.com/index.php/PHP_Toolkit">Toolkit for PHP 5.2+</a></li>
<li><a href="http://wiki.developerforce.com/index.php/PHP_Toolkit_11.0">Toolkit for PHP 5.1.2+</a></li>
<li><a href="http://wiki.developerforce.com/index.php/PHP_Toolkit_1.1">Toolkit for PHP 5.0+</a> (free DeveloperForce login required)</li>
</ul>
<p>All versions of the Toolkit require the curl, openssl, and soap extensions, the installation status of which can be determined by issuing `php -m` at the command line.</p>
<h3>Unpacking the Toolkit</h3>
<p>To set up the toolkit, simply unpack it.  I normally unpack it to lib/crm/salesforce, but the only thing that&#8217;s really important is to keep the Toolkit in its own directory so it can easily be upgraded.</p>
<h3>Sandboxes</h3>
<p>If you have sandbox access, I highly recommend testing your code there before running it against your production instance.  One reason for this (aside from inadvertently creating or deleting thousands of records, of course) is that the number of API calls per 24-hour period is metered, and once you&#8217;re out, you&#8217;re out.  This means that if your site relies on Salesforce being available via the API to function correctly, the results could be very damaging to your business.  If you have sandbox access, you can view your entitlement under Setup &gt; Data Management &gt; Sandbox.  The current API limits can be found <a href="http://www.salesforce.com/us/developer/docs/api/Content/implementation_considerations.htm#topic-title_request_metering">here</a>.</p>
<p>If you don&#8217;t have a sandbox already, go ahead and clone one off by going to Setup &gt; Data Management &gt; Sandbox.  The three types of sandboxes are:</p>
<ul>
<li>Configuration Only &#8211; Production configuration without the data.  Holds 500 MB.</li>
<li>Developer &#8211; The same as Configuration Only, but holds only 10 MB.</li>
<li>Full &#8211; A full copy of your production instance.</li>
</ul>
<p>A Configuration or Developer sandbox will be probably be fine, and if you do need a Full sandbox, keep in mind that it can take upwards of several hours to create.  Also, <b>sandboxes can only be refreshed every 30 days</b>, and you can typically only have one full copy at a time.  Another gotcha with sandboxes is that labels cannot currently be edited after the sandbox is created or refreshed, so go ahead and label yours now.  You don&#8217;t want to have to worry about someone refreshing your critical sandbox instance because they didn&#8217;t realize it was in use.  I tend to name my sandboxes &#8217;sbox1&#8242;, &#8217;sbox2&#8242;, etc., and to log into a sandbox called &#8217;sbox1&#8242;, &#8216;user@example.com&#8217; would log into SFDC at https://test.salesforce.com with the username &#8216;user@example.com.sbox1&#8242; and the same password they use on production.</p>
<p>Yet another thing to bear in mind when cloning off a sandbox is that the process will copy over your existing workflow rules from production, <b>and leave them active</b>.  This can cause a variety of issues, particularly if you have rules that trigger emails to mailing lists.  Depending on your IT infrastructure, mail loops can inadvertently be created because of this.  So, now would be a good time to disable any unnecessary workflow rules (under Setup &gt; Create &gt; Workflow &#038; Approvals &gt; Workflow Rules).</p>
<h3>Finally, Some Code</h3>
<p>We&#8217;ll go over this code in detail in the next entry, but I wanted to give you at least an idea of how straightforward it can be to develop against the API and integrate Salesforce and PHP.  The following snippet will declare some configuration constants, log in, create a lead, and log out.</p>
<p>Configuration passages:</p>
<pre>
define('SALESFORCE_USER', 'integration@example.com.sbox1');
define('SALESFORCE_PASS', '*password here*');
define('SALESFORCE_TOKEN', '*security token here*');
define('SALESFORCE_WSDL', '/path/to/enterprise.wsdl.xml');
</pre>
<p>Code:</p>
<pre>
$crmHandle = new SforceEnterpriseClient();
$crmHandle->createConnection(SALESFORCE_WSDL);
$crmHandle->login(SALESFORCE_USER, SALESFORCE_PASS . SALESFORCE_TOKEN);

// create our lead
$lead = array();
$lead['FirstName'] = 'Joe';
$lead['LastName'] = 'Moke';
$lead['Email'] = 'jmoke@example.com';
$lead['Title'] = 'CEO';
$lead['Company'] = 'Acme Widget Corporation';
$result = $crmHandle->create(array($lead), 'Lead');

$crmHandle->logout();
</pre>
<h3>Final Thoughts</h3>
<p>I hope you enjoyed my first entry, and I hope it was helpful.  I&#8217;ll generally be posting one or two entries a week, and next time, we&#8217;ll walk through getting your PHP environment configured to make the above snippet go, and start looking at some SFDC development considerations, gotchas, and quirks.  See you again shortly!</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Welcome+to+PHP+and+Salesforce%21+http://is.gd/9LKEL" title="Post to Twitter"><img class="nothumb" src="http://phpandsalesforce.com/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="[Post to Twitter]" border="0" /></a> <a class="tt" href="http://twitter.com/home/?status=Welcome+to+PHP+and+Salesforce%21+http://is.gd/9LKEL" title="Post to Twitter">Tweet This Post</a>&nbsp; </p>]]></content:encoded>
			<wfw:commentRss>http://phpandsalesforce.com/2009/06/16/welcome-to-php-and-salesforce/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
