PHP Classes

SouthCoast PHP Helpers Classes: General purpose classes to help PHP development

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 77 All time: 10,162 This week: 560Up
Version License PHP version Categories
southcoast-helpers 1.0.0The PHP License7PHP 5, Tools
Description 

Author

This package provides general purpose classes to help PHP development.

It comes with a collection of classes that can be used to help developers solve common Web development problems. Currently it provide helpers for:

- Manipulating arrays
- Logging actions
- Display messages in a console
- Load environment variables in a console
- Generate unique identifiers
- Validate and process JSON encode variable values
- Process hashed values
- Validate string values of several types
- Working with files on the local filesystem

Picture of Corné de Jong
  Performance   Level  

 

Example

<?php

File
::setBaseDirectory(TEMP_FOLDER);
File::defineDirectory('dir_identifier', '/Path/To/Dir', 'index_23');

File::list();
File::list('$dir_identifier');

File::list(File::BaseDirectory, 'txt');

/* Save file to defined directory */
File::save('$dir_identifier/thisname.tmp', $data);

File::get('$dir_identifier/thisname.tmp');

/* Save file to base directory as Json */
File::saveJson('thisname', $data, File::Minified);

File::getJson('thisname', true);

File::saveCsv('thiscsv', $data, true||[]);

File::getCsv('thiscsv', true);

/* Open a Write Stream to a file */
$stream = File::writeStream('anothername.txt');
/* Loop over all lines in a file */
foreach(File::readStream('thisname') as $line) {
   
$stream->write($line);
}
/* Close the stream */
$stream->close();

/* Move a file to another directory */
File::move('$dir_identifier/thisname.tmp', '$another_defined_dir');
/* Rename a file */
File::rename('$dir_identifier/thisname.tmp', 'thisnewname');

/* Get File Extention */
File::getExtention('thisname');
/* Get mime type */
File::getMimeType('thisname');

File::delete('thisname');

File::describe('thisname');

File::getDirectories();

File::getPath('thisname.json');


Details

SouthCoast | Helpers

A Collection of helper classes for PHP

Could be installed via composer:

$ composer require southcoast/helpers:dev-master

Or by manualy downloading the .zip file.

Enviroment

Create a file called 'sc.env'. This file should countain the following structure:

{
    "dev": true,
    "machine": "<Machine ID/Developer ID>",
    "...": "Any other parameters you'd like to add to your enviroment"
}

In your main php file load the env file.

$path_to_env = './sc.env';
Env::load($path_to_env);

  Files folder image Files (14)  
File Role Description
Files folder imageExamples (4 files)
Files folder imagesrc (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:77
This week:0
All time:10,162
This week:560Up