POT
POT
POT
Main menu

Download

Forum

SVN

Prev Next

PHK package

It will describe some basics about PHK packages and POT distribution packet.

Table of Contents

What is PHK

PHK stands for PHp pacKages. It is file format that follows Java .jar files idea - it allows to distribute multiple files in one package and load it at runtime as-it-is. You don't need to extract it like you do with .tar.gz package, but simply include like PHP file. You will find technical information about PHK format on it's homepage.

How to use

First of all - thought there is compat.php library included within POT.phk file you have to have PHP in version at least 5.1! It's just PHK requirement (you can find a note about that on PHK homepage).

In order to load POT from PHK archive you just need to include it. POT is still the same, so nothing changes in your codes. Here is an example startup script:

  1. <?php
  2.  
  3. // includes POT package
  4. include_once('POT.phk');
  5.  
  6. // database configuration - can be simply moved to external file, eg. config.php
  7. $config array(
  8.     'driver' => POT::DB_MYSQL,
  9. //    'prefix' => '',
  10.     'host' => 'localhost',
  11.     'user' => 'wrzasq',
  12. //    'password' => '',
  13.     'database' => 'otserv'
  14. );
  15.  
  16. // creates POT instance (or get existing one)
  17. $ots POT::getInstance();
  18. $ots->connect(null$config);
  19. // could be: $ots->connect(POT::DB_MYSQL, $config);
  20.  
  21. ?>

You can compare it to normal startup script. As you can see only one file has been changed. But it allows you to keep POT in one file, without messing with all those files around.

Other PHK modes

As you have maybe read on project's page PHK supports multiple run modes: web, cli, lib and webinfo. But POT is just a toolkit - it has no user interface to allow direct usage in cli and web modes. At all only useful way is to use this packet as library packet (including it in your PHP code). All other calls to this file will cause redirecting to our page or displaying information about it.


Development notes

In order to create/modify POT.phk package you need PHK_Creator package. On it's website you will find all required info about usage. In POT Makefile location of this file is set as /usr/bin/ but you should change it to your file location.

Prev Up Next
Additional info Additional info PHAR package