There are some situations when using Composer for dependency management isn't a viable option. In such cases, it is possible to get by with cloning two git repositories and setting up a simple PSR-0 autoloader.
This is of course the "advanced path" for getting started, so if you are not comfortable with git, it is recommended that you get Composer up and running.
The conventional path for third-party dependencies is vendor/
in the
root of your project. However, any path will do, as long as it is
read-accessible to PHP.
Create this directory, and if it's something other than vendor/
, simply
substitute it accordingly in the following explanation.
Next, you will need to clone two dependencies. The first is the CallFire SDK, and the second is Zend\Stdlib, which powers certain operations in the SDK.
In your vendor directory, run
git clone https://github.com/CallFire/CallFire-PHP-SDK.git
, and then change
to the created directory, and git checkout <tag>
, where <tag>
is the
specific version of the SDK that you desire (e.g. 1.0.0
).
Back in the vendor directory, create a directory path Zend/Stdlib
. Then, go to some temp directory and run
git clone https://github.com/zendframework/zend-stdlib.git
and git checkout release-2.2.6
to switch to required version.
(You can use any of 2.2 versions. To check all available versions please use git tag
command). After that copy all data
from zend-stdlib/src to already created Zend/Stdlib folder.
SplClassLoader
is a PSR-0 autoloader, recommended as the standard
implementation by the PSR working group.
The implementation is available at https://gist.github.com/jwage/221634
Create a file called SplClassLoader.php
in your vendor directory, and
place the SplClassLoader
code there.
Lastly, create your autoload file for these dependencies. In a file called
autoload.php
, in your vendor directory, place the following code:
<?php
require_once(__DIR__.'/SplClassLoader.php');
$callfireLoader = new SplClassLoader('CallFire', __DIR__.'/CallFire-PHP-SDK/src');
$callfireLoader->register();
$stdlibLoader = new SplClassLoader('Zend\Stdlib', __DIR__);
$stdlibLoader->register();
Depending upon the framework, or lack thereof, that you're utilizing for
your project, you will need to place an include
or require
statement
that references the autoload.php
file that you created above.
An example would be:
<?php
require_once(__DIR__.'/vendor/autoload.php');
Once the autoloader is included in your project, you will be able to continue as indicated in the remainder of the documentation.