2017 © Pedro PelĂĄez
 

library websites

image

germania-kg/websites

  • Tuesday, July 3, 2018
  • by germania-kg
  • Repository
  • 2 Watchers
  • 0 Stars
  • 235 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 23 Versions
  • 2 % Grown

The README.md

Germania KG · Websites

**This package was destilled from legacy code and is deprecated.*
You better do not want it to use this in production., (*1)

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

Upgrade notes

Upgrading from v2

Database: There is a new field route_name. See sql/install.sql.txt on how to create or add the fields., (*3)

Classes PdoAllWebsites and PdoRouteWebsiteFactory: Passing the pages table name to constructor is now mandatory., (*4)

Upgrading from v1

There are two new database fields javascripts and stylesheets. See sql/install.sql.txt on how to create or add the fields., (*5)

According to this, interface WebsiteInterface prescribes two methods getJavascripts and getStylesheets, its implementation class Website additionally introduces setJavascripts and setStylesheets., (*6)

Installation with Composer

$ composer require germania-kg/websites

MySQL: When working with database, create your tables using the CREATE TABLE statements in sql/install.sql.txt., (*7)

All Websites

The interface WebsitesInterface extends IteratorAggregate, Countable and the PSR-11 ContainerInterface., (*8)

Class Websites implements WebsitesInterface and thus can be iterated over and ‘counted’. The PdoAllWebsites class is an extension that reads from a MySQL Table., (*9)

getTitle(), PHP_EOL;
endforeach;

// ContainerInterface:
// Getting may throw WebsiteNotFoundException
// which implements Psr\Container\NotFoundExceptionInterface
$website_exists = $all_websites->has( 42 );
$website        = $all_websites->get( 42 );
?>

Get a website by route

<?php
use Germania\Websites\PdoRouteWebsiteFactory;
use Germania\Websites\WebsiteNotFoundException;
use Germania\Websites\Website;


// Instantiation
// - optional: Custom Website object template (extension of WebsiteAbstract)
$factory = new PdoRouteWebsiteFactory( $pdo, "my_pages" );
$factory = new PdoRouteWebsiteFactory( $pdo, "my_pages", new Website );
$factory = new PdoRouteWebsiteFactory( $pdo, "my_pages", null );

$route = "/index.html";

// interop ContainerInterface
$exists  = $factory->has( $route );

try { 
    // Callable or ContainerInterface's Getter
    $website = $factory( $route );
    $website = $factory->get( $route );
}
// Interop\Container\Exception\NotFoundException
catch (WebsiteNotFoundException $e) {
    // 404
}

Issues

Issue 1: MySQL 5.7.5 has a ONLY_FULL_GROUP_BY problem with the SQL query used in class PdoWebsiteRoutesAcl., (*10)

See issues list., (*11)

Development

$ git clone https://github.com/GermaniaKG/Websites.git
$ cd Websites
$ 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:, (*12)

$ composer test
# or
$ vendor/bin/phpunit

The Versions

14/06 2017
22/12 2016
22/12 2016
22/12 2016
21/12 2016
21/12 2016
21/12 2016
21/12 2016
21/12 2016
21/12 2016
20/12 2016

1.0.3

1.0.3.0

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Carsten Witt

03/11 2016

1.0.2

1.0.2.0

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Carsten Witt

03/11 2016

1.0.1

1.0.1.0

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Carsten Witt

02/11 2016

1.0.0

1.0.0.0

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Carsten Witt