Thepixeldeveloper\Nolimits2PackageLoader
, (*1)
When given a nlpkg produced by No Limits Coaster 2 this library will return information about the park and roller coasters., (*2)
Basic Usage
Did you know? A nlpkg file is the same as a ZIP file, (*3)
``` php
// First load the package using ZipArchive
$zip = new \ZipArchive;
$zip->open('raptor.nl2pkg');, (*4)
// Then give it to the package class to parse into useful information.
$package = new Thepixeldeveloper\Nolimits2PackageLoader\Package($zip);, (*5)
/**
* Examples of reading the preview image and park file
*/
$previewImage = $package->getPreviewImageStream();
$parkFile = $package->getParkFileStream();, (*6)
/**
* Instance of Thepixeldeveloper\Nolimits2PackageLoader\Park
*
* Contains information like the author and description.
*/
$parkInformation = $package->getParkInformation();, (*7)
/**
* Instance of Thepixeldeveloper\Nolimits2PackageLoader\Coasters
*
* Gives you an iterator which returns Coaster objects
*/
$coasters = $package->getCoasters();, (*8)
/**
* Instance of Thepixeldeveloper\Nolimits2PackageLoader\Coaster
*/
$coaster = $coasters->current();, (*9)
$coaster->getStyle(); // Mack Launch
$coaster->getName(); // Raptor
$coaster->getNumberOfTrains(); // 1
```, (*10)