1. Go to this page and download the library: Download toadsuck/core 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/ */
php
class Home extends Controller
{
public function __construct()
{
// Set our default template.
$this->template->layout('layouts/default');
}
public function index()
{
// Set some variables for all views.
$this->template->page_title = 'Toadsuck Skeleton';
// Render and Display the home/index view, passing a variable named "heading".
$this->template->output('home/index', ['heading' => 'Congratulations, it worked!']);
// Same as above, but return the rendered content instead of displaying.
// $content = $this->template->render('home/index', ['heading' => 'Congratulations, it worked!']);
}
}
php
class Home extends Controller
{
public function __construct()
{
// Set our default template.
$this->template->layout('layouts/default');
}
public function index()
{
// Grab our prefill content from the request and mass assign.
$this->template->setPrefill($this->input->get());
// Or we can pull the prefill content from session.
$this->template->setPrefill($this->session->get('prefill'));
// Render and Display the home/index view.
$this->template->output('home/index');
}
}
php
namespace Example\Project\Controllers;
use Illuminate\Database\Capsule\Manager as Model;
use Toadsuck\Core\Controller;
use Toadsuck\Core\Database as DB;
use Toadsuck\Skeleton\Models\Widget;
class Home extends Controller
{
// Internal Redirect (another resource in our app)
public function internalRedirect()
{
$this->redirect('home/foo'); # Foo method of the Home Controller.
}
// External Redirect
public function externalRedirect()
{
$this->redirect('http://www.google.com');
}
// Output data json-encoded with proper headers.
public function getJson()
{
$data = (object) ['items' => ['foo', 'bar']];
$this->json($data);
}
// Output data json-encoded with proper headers and callback.
// Default callback name is 'callback'
public function getJsonp()
{
$data = (object) ['items' => ['foo', 'bar']];
$this->jsonp($data, 'callback');
}
}
php
# Symfony way to access an attribute from $_POST
$foo = $this->request->request->get('foo');
# Toadsuck way to access an attribute from $_POST
$foo = $this->input->post('foo');
# Symfony way to access an attribute from $_GET
$foo = $this->request->query->get('foo');
# Toadsuck way to access an attribute from $_GET
$foo = $this->input->get('foo');
# Symfony way to access the entire $_POST array
$post = $this->request->request->all();
# Toadsuck way to access the entire $_POST array
$post = $this->input->post();
# Symfony way to access the entire $_GET array
$get = $this->request->query->all();
# Toadsuck way to access the entire $_GET array
$get = $this->input->get();