Ratings | | Unique User Downloads | | Download Rankings |
Not yet rated by the users | | Total: 77 | | All time: 10,157 This week: 560 |
|
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 | |
|
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);
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.