PHP code example of cmouleyre / lunacms

1. Go to this page and download the library: Download cmouleyre/lunacms 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/ */

    

cmouleyre / lunacms example snippets


namespace App\Controllers;

use LunaCMS\Controller;

class MyCustomController extends Controller
{
    public function dataAssignment(): void
    {
        $this->template = 'custom_template';
        $this->addVar('meta_title', 'Custom Page Title');
        $this->addVar('meta_description', 'Custom Page Description');
    }
}

  $this->setRedisValue('key', 'value', $ttl);
  

  $value = $this->getRedisValue('key');
  

$this->sendEmail('[email protected]', 'Recipient Name', 'Subject', 'HTML Body', 'Plain Text Alternative');

use App\Controllers\PageController;

return [
    '' => PageController::class,
    '{slug}' => PageController::class,
];
sh
  npm install --global gulp-cli
  
sh
   cd vendor/cmouleyre/lunacms/
   php create_site.php /path/to/new/site
   
sh
php create_site.php /path/to/new/site