PHP code example of vgalvoso / phunctional
1. Go to this page and download the library: Download vgalvoso/phunctional 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/ */
vgalvoso / phunctional example snippets
view("", "home");
view("hello", "hello_world");
notFound();
view("", "home");
view("hello", "hello_world");
notFound();
post("validateLogin", "login");
get("getUsers", "users/all");
notFound();
$db = array(
"default" => array(
"server" => getenv('DEFAULT_SERVER'),
"user" => getenv('DEFAULT_USER'),
"pass" => getenv('DEFAULT_PASS'),
"dbname" => getenv('DEFAULT_DBNAME'),
"driver" => getenv('DEFAULT_DRIVER'),
"port" => getenv('DEFAULT_PORT')
)
);
$query = "INSERT INTO users (username, email, password) VALUES (:username, :email, :password)";
$inputs = [
"username" => $username,
"email" => $email,
"password" => password_hash($password, PASSWORD_DEFAULT),
];
if ($sql->exec($query, $inputs))
echo "User added successfully.";
else
echo "Error adding user: " . $sql->getError();
post("users", "add_user");
api/
lib/
Database.php
DotEnv.php
Helper.php
Sql.php
public/
css/
js/
res/
routes/
api.php
view.php
view/
section/
header.php
footer.php
.env
.htaccess
index.php
README.md