This file contains hidden or 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", |
This file contains hidden or 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->add(function (Request $request, Response $response, $next) { | |
| if ($request->getUri()->getScheme() !== 'https') { | |
| $uri = $request->getUri()->withScheme("https")->withPort(null); | |
| return $response->withRedirect( (string)$uri ); | |
| } else { | |
| return $next($request, $response); | |
| } | |
| }); |
This file contains hidden or 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
| function ew_GetKeyword(&$src, &$kwlist, &$x, &$y, &$kw) { | |
| $thisy = -1; | |
| $thiskw = ""; | |
| foreach ($kwlist as $wrkkw) { | |
| $wrkkw = trim($wrkkw); | |
| if (EW_HIGHLIGHT_COMPARE) { // Case-insensitive | |
| if (function_exists('stripos')) { // PHP 5 | |
| $wrky = stripos($src, $wrkkw, $x); | |
| } else { | |
| $wrky = strpos(strtoupper($src), strtoupper($wrkkw), $x); |
This file contains hidden or 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
| /* | |
| Building a Middleware for Authentication | |
| Components: | |
| 1) AuthFactory | |
| - Responsible for creating the the session and loading it with data | |
| */ | |
| interface IAuthFactory { | |
| public function setData($data = []); | |
| } |
This file contains hidden or 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
| //... | |
| ob_start(); | |
| include "home.php"; | |
| $body = ob_get_clean(); | |
| returen $response->write($body); |
This file contains hidden or 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 | |
| namespace Space; | |
| class RouteManager { | |
| public function __construct() { | |
| $app = \Slim\Slim::getInstance(); | |
| $app->get('/', function () { | |
| print "hi"; | |
| }); |
This file contains hidden or 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 | |
| class UserTest extends \PHPUnit_Framework_TestCase { | |
| /** | |
| * | |
| * @var GuzzleHttp\Client | |
| */ | |
| private $client; | |
| public function setUp() { |
This file contains hidden or 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
| RewriteEngine On | |
| # Some hosts may require you to use the `RewriteBase` directive. | |
| # If you need to use the `RewriteBase` directive, it should be the | |
| # absolute physical path to the directory that contains this htaccess file. | |
| # | |
| # RewriteBase / | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteRule ^ index.php [QSA,L] |
This file contains hidden or 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 | |
| namespace VMS\Traits; | |
| trait UserRelationshipTrait { | |
| /** | |
| * @return \Illuminate\Database\Eloquent\Relations\HasOne | |
| */ | |
| public function users() { | |
| return $this->hasOne("VMS\Models\User"); |
This file contains hidden or 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
| Capsule::connection() | |
| ->table('jobs') | |
| ->join('job_codes', 'jobs.id', '=', 'job_codes.job_id') | |
| ->join('codes', 'codes.id', '=', 'job_codes.code_id') | |
| ->where('date', '=', $date, 'and') | |
| ->where('user_id', '=', $pein) | |
| ->select("*"); |