2017 © Pedro Peláez
 

library common

image

ceus-media/common

  • Friday, July 20, 2018
  • by kriss0r
  • Repository
  • 1 Watchers
  • 1 Stars
  • 2,210 Installations
  • PHP
  • 19 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 27 Versions
  • 4 % Grown

The README.md

CeusMedia Common

A library of PHP classes for common tasks., (*1)

Branch Release PHP version PHPStan level Total downloads Package version License, (*2)

Features

  • Categorized classes for different basic tasks
    • File and Folder indexing
    • File Handling (CSV, iCal, INI, JSON, vCard, YAML, XML etc.)
    • HTTP & FTP handling
    • CLI handling
    • HTML & image
    • Data types and algorithms
  • Class names with namespaces
  • Typed properties
  • Types method arguments
  • Code quality
    • PHPStan level 9 complete + extra strict rules
    • Rector 7.4 rule set complete
    • PHPUnit 9.5 & some unit tests
  • Composer scripts for development

Usage

Installing the library via composer and packagist., (*3)

composer require ceus-media/common

Usage:, (*4)

require_once 'vendor/autoload.php';

$atomDateTime = CeusMedia\Common\Net\AtomTime::get();
print 'Atom Time: '.$atomDateTime->format( DATE_COOKIE ).PHP_EOL;

This will show the current Atom Time., (*5)

Example script

require_once 'vendor/autoload.php';

use CeusMedia\Common\Alg\Time\DurationPhraser;
use CeusMedia\Common\FS\File;

$file = new File( __FILE__ );

$timeRangePhrases = [
    0       => '{s} seconds',
    60      => '{m} minutes',
    3600    => '{h} hours',
    24*3600 => 'ages'
];

$phraser    = DurationPhraser::fromArray( $timeRangePhrases );
$duration   = $phraser->getPhraseFromTimestamp( $file->getTime() );

echo vsprintf( 'This file (%s) has been modified %s ago.'.PHP_EOL, [
    $file->getName(),
    $duration,
] );

This will show the age of this script file.
From here, you could use the DurationPhraser on other entity timestamps, like a comment, stored in a database. Also, this example shows basic file access.
This is really just the tip of the iceberg.
, (*6)

Migration from 0.8.x

During migrating older projects, based on version 0.8.x, you can enable a backwards compatibility mode:, (*7)

require 'vendor/ceus-media/common/src/compat8.php';

But you should not do this in production to have the best performance., (*8)

The Versions

20/07 2018

dev-master

9999999-dev

  Sources   Download

GPL-3.0+ GPL-3.0-or-later

The Requires

  • php ^5.3.0 || ^7

 

The Development Requires

20/07 2018

0.8.4.5

0.8.4.5

  Sources   Download

GPL-3.0-or-later

The Requires

  • php ^5.3.0 || ^7

 

The Development Requires

23/05 2018

0.8.4.4

0.8.4.4

  Sources   Download

GPL-3.0-or-later

The Requires

  • php ^5.3.0 || ^7

 

The Development Requires

04/04 2018

0.8.4.3

0.8.4.3

  Sources   Download

GPL-3.0-or-later

The Requires

  • php ^5.3.0 || ^7

 

The Development Requires

07/03 2018

0.8.4.2

0.8.4.2

  Sources   Download

GPL-3.0-or-later

The Requires

  • php ^5.3.0 || ^7

 

The Development Requires

20/04 2016

0.8.2

0.8.2.0

  Sources   Download

GPL-3.0+

05/06 2015

0.8.1

0.8.1.0

  Sources   Download

GPL-3.0+

28/05 2015

0.7.7.x-dev

0.7.7.9999999-dev

  Sources   Download

GPL-3.0+