PHP code example of l2jbrasil / l2jphp

1. Go to this page and download the library: Download l2jbrasil/l2jphp library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

l2jbrasil / l2jphp example snippets




define('L2JBR_DIST', "L2JSERVER"); //What is the distribution?
define('L2JBR_L2VERSION', "Interlude"); //What is the chronicle? Kamael, God, Classic, any generec name.

//$CharactersModel = new \L2jBrasil\L2JPHP\Models\Dist\Interlude\L2JSERVER\Players\Characters(); //Compatible only with L2JSERVER databases
$CharactersModel = \L2jBrasil\L2JPHP\ModelFactory::build('Players/Characters'); //Compatible for all suported modules
$CharactersModel->get('ID');
$CharactersModel->update('ID', ["name"=> "Grundor"]);
$CharactersModel->ban('ID');
$CharactersModel->all(['name','level'],false,10,'level'); //Retorna os 10 personagens com maior level.

//Advanced:
$CharactersModel->select(['character.id','account.name'])
    ->join(\L2jBrasil\L2JPHP\ModelFactory::build('Players/Account'))
    ->orderby('level')
    ->limit(100)
    ->query()
    ->FetchAll();