Location: PHPKode > projects > Open Power Template > docs/Opl/installation.phar.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="pl">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta name="robots" content="all" />

	<title>PHAR installation - Open Power Libs</title>
	
	<link rel="stylesheet" type="text/css" href="design/generic.css" media="all"  />
	<link rel="stylesheet" type="text/css" href="design/print.css" media="print" />
	<!--[if lte IE 6]><link rel="stylesheet" href="design/ie.css" type="text/css" /><![endif]-->	
	<!--[if IE 7]><link rel="stylesheet" href="design/ie7.css" type="text/css" /><![endif]-->
</head>
<body>

<div id="wrap">
	<div id="header">
		<h1>Open Power Libs 2.0</h1>
		<h2>PHAR installation</h2>
		<p class="generated">@ 02.09.2010</p>
		<p class="location"><a href="index.html"><strong>User manual</strong></a> &raquo; <a href="installation.html">Installation</a> &raquo; <a href="installation.phar.html">PHAR installation</a></p>
	</div>
	
	<div id="content"><dl class="location"><dt><a href="installation.html">2. Installation</a><br/>2.2. PHAR installation</dt><dd class="prev">2.1. Standard installation<br/><a href="installation.standard.html">&laquo; Previous</a></dd><dd class="next">3. Design and concepts<br/><a href="design.html">Next &raquo;</a></dd></dl>	<h1>2.2. PHAR installation</h1><p>PHAR archives solve some problems with the directory structure and the initialization. Be sure that you have the appropriate archives and simply include them:</p>

<pre class="php"><span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'./opl.phar'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'./opt.phar'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'./opf.phar'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// use the libraries now</span></pre>

<p>All the initialization is done automatically.</p>

<blockquote class="information">
  <p>When loading a PHAR archive like above, PHP does not parse and execute all the scripts in the archive. It executes only the part called <em>stub</em> which initializes the library. The rest of the content is executed on demand.</p>
</blockquote>

<p>The ordinary directory structure is necessary, if you are going to use third party components and add-ons. OPL libraries allow you to load them with the plugin system or include and register manually. In the second case, you might need to specify the exact paths to the class files manually, because the autoloader will try to find them in the archives:</p>

<pre class="php"><span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'./opl.phar'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'./opt.phar'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'./opf.phar'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
Opl_Loader<span style="color: #339933;">::</span><span style="color: #004000;">mapAbsolute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Opx_Extra_Addon'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'./addons/Opx/Extra/Addon.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>

<blockquote class="information">
  <p>You can also pack the addons into another PHAR archive and configure the stub properly.</p>
</blockquote>
<dl class="location location-bottom"><dt>2.2. PHAR installation<br/><a href="installation.html">2. Installation</a></dt><dd class="prev"><a href="installation.standard.html">&laquo; Previous</a><br/>2.1. Standard installation</dd><dd class="next"><a href="design.html">Next &raquo;</a><br/>3. Design and concepts</dd></dl>		</div>
	
	<div id="footer">
		<p>Copyright &copy; <a href="http://www.invenzzia.org/">Invenzzia Group 2008-2009</a></p>
		<p>Available under the terms of license: <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License 1.2</a></p>
		<p>Generated by <strong>TypeFriendly 0.1.4</strong> by <a href="http://www.invenzzia.org/">Invenzzia</a></p>
	</div>
</div>

</body>
</html>
Return current item: Open Power Template