PLib, the Poppa PHP Library

Published 14 February, 2008 in Programming - 0 Comments

Other than working my ass off at work I just lately took a real approach on my secretly sleeping project PLib. PLib is my own PHP framework with functions and classes to ease my everyday PHP programming.

To give you an idea of what PLib is all about let me give you an example:

18 lines of PHP
  1. <?php
  2. require_once ‘/path/to/PLib.php’;
  3. //! Lets create thumbnails of all JPEG images in a directory
  4. PLib::Import(‘Graphics.Image’);
  5. //! The Dir class is included in Image so I don’t explicitly need to
  6. //! include it
  7. $dir = new Dir(‘/path/to/jpegs/’);
  8. $mw = 150; // Max width of thumb
  9. $mh = 90; // Max height of thumb
  10. while ($file = $dir>Emit(‘*.jpg’)) {
  11. $img = new Image($file>path);
  12. $img = $img>Copy($file>path.‘/thumb-‘.$file>name)>Scale($mw, $mh);
  13. wbr($img>Path()); // The full path to the thumbnail
  14. }
  15. ?>

Rather easy I think!

AutoDoc

Another cool feature (if I may say so) is the auto documentation. If you quickly want a list of all available classes and functions just type PLib::Info() and you will get the list. Each class and function is then clickable and will lead you to the documentation for which ever class or function you clicked.

If you want the documentation for a specific class just type PLib::Info() and there you have the documentation.

The third way to use the autodoc is to pass an instance of a class as argument like PLib::Info().

And if you wan’t a full documentation site just type PLib::Info() and you will get the same documentation as available at the PLib site.

The site

Anyway, PLib has its site of it’s own where anyone curious can download the latest version of PLib and find out more about the project.

plib.poppa.se