PHP code example of enygma / slim-app-skeleton

1. Go to this page and download the library: Download enygma/slim-app-skeleton 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/ */

    

enygma / slim-app-skeleton example snippets




namespace App\Controller;

class FooController extends \App\Controller\BaseController
{
    public function index()
    {
        return $this->render('/foo/index.php');
    }
}

$app->get('/foo', '\App\Controller\FooController:index');



namespace App\Controller;

class IndexController extends \App\Controller\BaseController
{
    public function index()
    {
        $myValue = 'foo';
        // Set the value
        $this->session->set('myvalue', $myValue);

        // Get the value
        $this->session->get('myvalue');

        return $this->render('/index/index.php');
    }
}



namespace App\Model;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
	/* nothing to see, move along */
}

$user = new \App\Model\User();



namespace App\Controller;

class IndexController extends \App\Controller\BaseController
{
    public function index($request, $response, $args)
    {
        $data = [];
        $validator = \Psecio\Validation\Validator::getInstance('request.slim3');

        $result = $validator->execute($request, [
            'email' => '



namespace App\Controller;

class IndexController extends \App\Controller\BaseController
{
    public function index($request, $response, $args)
    {
		$string = 'this is my string';

		// Encrypt the string for use in the page
		// You can decrypt this data with the $this->encryption->decrypt($data) call
		$data = [
			'string' => $this->encryption->encrypt($string)
		];

		return $this->render('/index/index.php', $data);
	}
}

php -r '

php -S localhost:8080