PHP code example of mix / web-skeleton
1. Go to this page and download the library: Download mix/web-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/ */
mix / web-skeleton example snippets
$vega->handle('/', [new Hello(), 'index'])->methods('GET');
namespace App\Controller;
use Mix\Vega\Context;
class Hello
{
/**
* @param Context $ctx
*/
public function index(Context $ctx)
{
$ctx->HTML(200, 'index', [
'title' => 'Hello, World!'
]);
}
}
<html>
<h1>
<?= $title
json
"scripts": {
"cliserver:start": "php -S localhost:8000 -t public",
"swoole:start": "php bin/swoole.php",
"swooleco:start": "php bin/swooleco.php",
"workerman:start": "php bin/workerman.php start",
"cli:clearcache": "php bin/cli.php clearcache"
}
php bin/swoole.php start
server {
server_name www.domain.com;
listen 80;
root /data/project/public;
index index.html index.php;
location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
}
}
location ~ ^(.+\.php)(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;