Libraries and dependency resolution
Including PHP scripts using include and require from libraries resolved using Ivy.
PHP, in IBM® WebSphere® sMash, supports the standard
include
and
require
functionality. The
include
,
require
,
include_once
, and
require_once
API all behave as you'd expect. You can modify the include path by editing the
php.ini
file. In addition to these created includes, the WebSphere sMash system can modify the
include
path at runtime to include scripts contributed by Ivy dependencies.
WebSphere sMash applications and Ivy dependencies both contribute PHP scripts in the same way. To add PHP scripts,
simply add your PHP files to the
app/scripts
directory. For example, you might have a PHP application with the
zero.data.php
dependency in
config/ivy.xml
. If you were to browse the
zero.data.php
dependency in the local repository, you would see an
app/scripts
directory that contained a file named
JSONResultHandler.php
. The code below demonstrates how to include this file.
<?php include "JSONResultHandler.php"; ?>
WebSphere sMash applications can also include PHP scripts from their own
app/scripts
directory. Any scripts placed there are protected in that they cannot be downloaded directly from
the running application. Place any scripts containing sensitive information in this location.