PHP code example of ingwiephoenix / bird3-flipflop
1. Go to this page and download the library: Download ingwiephoenix/bird3-flipflop 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/ */
ingwiephoenix / bird3-flipflop example snippets
// While bootstrapping...
// By default: app_path("Resources/Views/Layouts")
// But you can always append another path.
View::addLocation(app_path("Resources/theme"));
// Or add modules and such as "namespace". Note, the two are idendical.
View::addNamespace("Derp", app_path("Derp/Views"));
// When sending back a response...
Route::get("/", function(){
return View::make("Derp::index");
});
Route::get("/bad-guy", function(){
$view = View::make("Herp::showcase");
return $view->with(["foo"=>42]);
});
// Use a custom context.
Route::get("/customer", function(){
// Using traditional View API:
$view = View::make("Customer::main");
$view->getEngine()->setContext(Auth::user());
// Via facade
$view = FlipFlop::loadWithContext("Customer::main", Auth::user());
return $view;
});