2017 © Pedro Peláez
 

library pathserviceprovider

image

germania-kg/pathserviceprovider

  • Friday, July 20, 2018
  • by germania-kg
  • Repository
  • 2 Watchers
  • 0 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 42 % Grown

The README.md

Germania KG · PathServiceProvider

Pimple Service Provider for working with directory path strings, (*1)

Packagist PHP version Build Status Scrutinizer Code Quality Code Coverage Build Status, (*2)

Installation

$ composer require germania-kg/pathserviceprovider

Setup

<?php
use Germania\PathServiceProvider\PathServiceProvider;

// A. Use with Slim or Pimple
$app = new \Slim\App;
$dic = $app->getContainer();
$dic = new Pimple\Container;

// B. Register Service Provider. Paths array is optional.
$sp = new PathServiceProvider;
$sp = new PathServiceProvider( [
    'var',
    'templates' 
]);

$dic->register( $sp  );

Using a custom prefixer callable. There's also a package for this, try germania-kg/pathprefixer., (*3)

// C. Pass optional callable
$sp = new PathServiceProvider( $paths, function( $path ) {
    return '/path/to/project/' . $path;
});
$dic->register( $sp  );

Services

Paths

Returns the paths array passed to constructor., (*4)

$paths = $dic['Paths'];
// array(
//  'var',
//  'templates' 
// )

Paths.Prefixer

Returns the prefixer callable, (*5)

$prefixer = $dic['Paths.Prefixer'];

Paths.absolute

Returns the paths array with each element prefixed before:, (*6)

$absolute_paths = $dic['Paths.absolute'];

Development

$ git clone https://github.com/GermaniaKG/PathServiceProvider.git
$ cd PathServiceProvider
$ composer install

Unit tests

Either copy phpunit.xml.dist to phpunit.xml and adapt to your needs, or leave as is. Run PhpUnit test or composer scripts like this:, (*7)

$ composer test
# or
$ vendor/bin/phpunit

The Versions

20/07 2018

dev-develop

dev-develop

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Carsten Witt

20/07 2018

dev-master

9999999-dev

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Carsten Witt

20/07 2018

1.0.2

1.0.2.0

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Carsten Witt

05/02 2018

1.0.1

1.0.1.0

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Carsten Witt

05/02 2018

1.0.0

1.0.0.0

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Carsten Witt