PHP code example of dkplus / base

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

    

dkplus / base example snippets


class MyController
{
    // […]

    public function editAction()
    {
        $entity = $this->service->find($this->params()->fromRoute('id'));
        if (!$entity) {
            return $this->notFoundForward('MyController', array('action' => 'index'), 'my-route');
        }

        // […]

    }
}

foreach ($this->flashMessenger('404-not-found')->getCurrentMessages() as $message) {
    print $this->escapeHtml($message) . '<br>';
}

foreach ($this->flashMessenger('error')->getMessages() as $message) {
    print $this->escapeHtml($message) . '<br>';
}