PHP code example of ianaldrighetti / lmmvc

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

    

ianaldrighetti / lmmvc example snippets


// All your controllers must belong to the same namespace (at the same level).
// Then you tell LMMVC which namespace to look at using the setNamespace method.
namespace YourControllerNamespace;

use LmMvc\BaseController;

class MyController implements BaseController
{
  /**
   * This is the index of the controller.
   */
  public function index()
  {
  
  }
  
  /**
   * This would be accessible through {your_url}/my_controller/another_page.
   */
  public function another_page()
  {
  
  }
}

public function args($userId, $userName = 'you', array $data)
{
  // *do awesome stuff*
}

// Invoke a function name for casing.
$application->setControllerCaser('function_name');

// If you are on the right PHP version, you can do:
$application->setControllerCaser(function($controllerName)
  {
    // *do stuff*
    return $controllerName;
  });

// You can also do classes:
$application->setControllerCaser(array($object, 'methodName'));

// Or a static method in a class:
$application->setController(array('\\Class\\Namespace\\ClassName', 'methodName'));

$application->setExceptionHandler($exceptionHandler);

$application->setNamespace('\\Your\\Application\\Controller');

$application->setDefaultController('default_page');

$application->run();
$data[0]