Assumptions:
- You have
hub
(https://github.com/github/hub) installed - You have your own fork of Slim as
origin
and have added slimphp/slim as a remote calledupstream
Process:
- Update:
$ git checkout 4.x && git pull upstream 4.x
<?php declare(strict_types=1); | |
namespace App\Factory; | |
use Psr\Http\Message\RequestInterface; | |
use Psr\Http\Message\ResponseInterface; | |
use Tuupola\Middleware\Cors; | |
use Zend\Diactoros\Response; | |
use Zend\Diactoros\Response\JsonResponse; | |
use Zend\ProblemDetails\ProblemDetailsResponseFactory; | |
use Zend\Stratigility\Middleware\CallableMiddlewareWrapper; |
// Rock Paper Scissors game | |
// To install: | |
// $ wsk action update rock-paper-scissors rock-paper-scissors.swift | |
// | |
// To play: | |
// $ wsk action invoke rock-paper-scissors -r -p shape rock | |
import Foundation | |
func main(args: [String:Any]) -> [String:Any] { |
# OpenWhisk | |
function owibm() { | |
wsk property set --apihost openwhisk.ng.bluemix.net --auth {auth key here} | |
wsk property unset --namespace | |
} | |
function owlocal() { | |
( | |
cd ~/Projects/openwhisk/openwhisk/tools/vagrant && \ |
Assumptions:
hub
(https://github.com/github/hub) installedorigin
and have added slimphp/slim as a remote called upstream
Process:
$ git checkout 4.x && git pull upstream 4.x
.PHONY: all clean keynote | |
# name of the PDF to create | |
pdf = ../2017-02-22-PHPOxford-Slim-OAuth2.pdf | |
# Aspect ratio of Keynote file | |
# common choices: | |
# 1024 x 768 | |
# 1280 x 720 | |
aspect_ratio = 1280 x 720 |
<?php | |
class CustomerMaintenanceControllerFactory | |
{ | |
public function __invoke($c) { | |
$customerMapper = $c->get('CustomerMapper'); | |
$deleteForm = $c->get('CustomerDeleteForm'); | |
$editForm = $c->get('CustomerEditForm'); | |
return new CustomerMaintenanceController($customerMapper, $deleteForm, $editForm); | |
} |
<?php | |
// Using ControllerPluginManager factories to inject dependencies into | |
// a controller in ZF2 and ZF3 | |
namespace My; | |
use Zend\Mvc\Controller\PluginManager as ControllerPluginManager; | |
class BookControllerFactory { | |
public function __invoke($container) { | |
// in ZF2, $container is an instance of ControllerPluginManager |
<?php | |
require('vendor/autoload.php'); | |
use Zend\ServiceManager\Factory\InvokableFactory; | |
//-------------------------------------------------------- | |
// classes that we are interested in | |
class Letter { | |
public function __construct($paper, $envelope) { | |
$this->paper = $paper; |
<?php | |
$app->add(function ($request, $response, $next) { | |
// use the original request and ignore the one passed into us | |
$request = $this->get('request'); | |
// do something here | |
// continue | |
return $next($request, $response); | |
}); |
Things to do before leaving
Tech stuff