2017 © Pedro Peláez
 

library chubbyphp-csrf

Chubbyphp Csrf

image

chubbyphp/chubbyphp-csrf

Chubbyphp Csrf

  • Sunday, April 22, 2018
  • by dominikzogg
  • Repository
  • 0 Watchers
  • 0 Stars
  • 49 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

chubbyphp-csrf

Build Status Total Downloads Latest Stable Version Scrutinizer Code Quality Code Coverage, (*1)

Description

A simple csrf solution based on [chubbyphp/chubbyphp-session][2]., (*2)

Requirements

  • php: ~7.0
  • chubbyphp/chubbyphp-error-handler: ~1.0
  • chubbyphp/chubbyphp-session: ~1.0
  • psr/log: ~1.0

Suggest

  • pimple/pimple: ~3.0

Installation

Through Composer as chubbyphp/chubbyphp-csrf., (*3)

composer require chubbyphp/chubbyphp-csrf "~1.0"

Usage

CsrfErrorResponseMiddleware

<?php

use Chubbyphp\Csrf\CsrfErrorHandlerInterface;
use Chubbyphp\Csrf\CsrfErrorResponseMiddleware;
use Chubbyphp\Csrf\CsrfTokenGenerator;
use Chubbyphp\Session\Session;

$session = new Session();
$middleware = new CsrfErrorResponseMiddleware(
    new CsrfTokenGenerator(),
    $session,
    new class() implements CsrfErrorHandlerInterface {
        public function errorResponse(
            Request $request,
            Response $response,
            int $code,
            string $reasonPhrase
        ): Response {
            return $response->withStatus($code, $reasonPhrase);
        }
    }
);

/** @var Slim\App $app */
$app->add($middleware);

CsrfMiddleware (deprecated)

<?php

use Chubbyphp\Csrf\CsrfMiddleware;
use Chubbyphp\Csrf\CsrfTokenGenerator;
use Chubbyphp\Session\Session;

$session = new Session();
$middleware = new CsrfMiddleware(new CsrfTokenGenerator(), $session);

/** @var Slim\App $app */
$app->add($middleware);

CsrfProvider (Pimple)

<?php

namespace Chubbyphp\Csrf\CsrfProvider;
namespace Chubbyphp\Csrf\SessionProvider;
namespace Pimple\Container;

$container = new Container();
$container->register(new CsrfProvider());
$container->register(new SessionProvider());

/** @var Slim\App $app */
$app->add($container['csrf.middleware']);

CsrfTokenGenerator

<?php

use Chubbyphp\Csrf\CsrfTokenGenerator;

$generator = new CsrfTokenGenerator();

Dominik Zogg 2016, (*4)

The Versions

22/04 2018

dev-master

9999999-dev

Chubbyphp Csrf

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

slim csrf chubbyphp

22/04 2018

1.1.1

1.1.1.0

Chubbyphp Csrf

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

slim csrf chubbyphp

27/06 2017

1.1.0

1.1.0.0

Chubbyphp Csrf

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

slim csrf chubbyphp

05/05 2017

1.0.3

1.0.3.0

Chubbyphp Csrf

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

slim csrf chubbyphp

26/04 2017

1.0.2

1.0.2.0

Chubbyphp Csrf

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

slim csrf chubbyphp

12/10 2016

1.0.0

1.0.0.0

Chubbyphp Csrf

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

slim csrf chubbyphp

12/10 2016

1.0.0-beta1

1.0.0.0-beta1

Chubbyphp Csrf

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

slim csrf chubbyphp

12/10 2016

1.0.1

1.0.1.0

Chubbyphp Csrf

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

slim csrf chubbyphp

03/10 2016

1.0.0-alpha1

1.0.0.0-alpha1

Chubbyphp Csrf

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

slim csrf chubbyphp