This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# eve-text-mud | |
## Player States: | |
Space | |
Docked | |
# Command List | |
### Space Commands | |
- .dock <object> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$near = "SELECT c.id, c.name, c.email, c.phone, c.logo, c.banner, c.description, cl.lat, cl.lng, | |
ACOS( SIN( RADIANS( cl.lat ) ) * SIN( RADIANS( '$lat' ) ) + COS( RADIANS( cl.lat ) ) | |
* COS( RADIANS( '$lat' )) * COS( RADIANS( cl.lng ) - RADIANS( '$lng' )) ) * 6380 AS distance | |
FROM CLIENT_LOCATION cl | |
INNER JOIN CLIENT c | |
on cl.client_id = c.id | |
WHERE | |
ACOS( SIN( RADIANS( cl.lat ) ) * SIN( RADIANS( ? ) ) + COS( RADIANS( cl.lat ) ) | |
* COS( RADIANS(? )) * COS( RADIANS( cl.lng ) - RADIANS( ? )) ) * 6380 < 10 | |
ORDER BY distance ASC"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$app->add(function ($req, $res, $next) { | |
//DO SOMETHING BEFORE THE REQUEST IS PROCESSED | |
$res = $next($req, $res); //PROCESS THE REQUEST | |
//DO SOMETHING AFTER THE REQUEST HAS BEEN PROCESSED | |
if ($res->getStatusCode() > 500) { | |
//Do something with a server error, maybe email someone or submit a bug report | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$myPOST = $request->getParsedBody(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$myGET = $request->getQueryParams(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Let's use it! | |
$app->get('/hello[/[{name}]]', function ($req, $res, $args) { | |
if (!empty($args['name'])) { | |
return $this->view->render($res, "hello.twig", ["name" => $args['name']]); | |
} else { | |
return $this->view->render($res, "hello.twig", ["name" => ""]); | |
} | |
}); | |
$app->run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$app->get('/hello[/[{name}]]', function ($req, $res, $args) { | |
$get = $req->getQueryParams(); // Grab the Query Params... ["test" => "true"] | |
if (!empty($args['name'])) { | |
return $this->view->render($res, "hello.twig", ["name" => $args['name'], "test" => $get['test']]); | |
} else { | |
return $this->view->render($res, "hello.twig", ["name" => "", "test" => $get['test']]); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Let's configure it. | |
// Fetch DI Container | |
$container = $app->getContainer(); | |
// Register Twig View helper and configure it | |
$container['view'] = function ($c) { | |
//You can change this as you want | |
$view = new \Slim\Views\Twig('templates', [ | |
'cache' => false //or specify a cache directory | |
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$app->get('/hello[/[{name}]]', function ($req, $res, $args) { | |
if (!empty($args['name'])) { | |
return $res->write("Why Hello " . $args['name']); | |
} else { | |
return $res->write("Hello!"); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Use case | |
I have several "components" which are standalone Slim applications. | |
Maybe its a "UserManagement"... while I can run this module at /users on it's own... I want to install this package on another larger project. | |
In my main app, | |
I load "components"... | |
$components = [ | |
"UserManagement" => [ | |
"routes" => "../usermanagement/routes.php", |