2017 © Pedro PelĂĄez
 

library utils

PHP Swiss Knife - basic utilities for quick coding

image

raphievila/utils

PHP Swiss Knife - basic utilities for quick coding

  • Tuesday, April 3, 2018
  • by raphievila
  • Repository
  • 1 Watchers
  • 0 Stars
  • 20 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 25 % Grown

The README.md

Utils

Utils object is desinged as a swiss knife of functions that is normally used for simple tasks as converting decimals to string fractions, checking values, basic cross scripting and curl initializers with easy to remember arguments., (*1)

It requires xTags another piece of code to generate html tag structures with PHP object oriented methods., (*2)

To Install

Using terminal, install with composer:, (*3)

$> composer require raphievila/utils

USE

I've added some comments to the script that shows how to use each tool. There is no specific use for the tools, I mostly use them to help visually during developing and other little pieces of codes that can help you speed your coding., (*4)

To use the class just include where needed like so:, (*5)

require 'directory-composer-is-located/vendor/autoload.php';
use Utils\Utils;

$u = new Utils();

Some Useful Examples

Echo Array

Echo array is a quick snipped of code that place an array or object inside a predefined tag, instead of constantly typing the whole code I just use:, (*6)

$array = ['hello', 'world'];
echo $u->echo_array($array);

This will render as:, (*7)

<pre>
$array = Array(
    'hello',
    'world'
)
</pre>

I also recently added echo_text($string) which renders a string into a text area <textarea> tag., (*8)

Current Site URL

Creating dynamic URLs is very useful for transporting site from one domain to another, instead of using static urls like https://github.com. With site_url() method applied to all your links, will maintain this dynamic while redering a static full url. Only returns the main server name or domain., (*9)

Example:, (*10)

use xTags\xTags;
$x = new xTags();

echo $x->p($u->site_url());
echo $x->a('Hello World', array('href' => $u->site_url() . "/hello-world"));

Renders:, (*11)




http://example.com, (*12)

<a href="https://example.com/hellow-world">Hello World</a>

https://new-example.com, (*13)

<a href="https://new-example.com/hello-world">Hello World</a>

The Versions

03/04 2018

dev-master

9999999-dev

PHP Swiss Knife - basic utilities for quick coding

  Sources   Download

GPL-3.0

The Requires

 

11/09 2017

1.0.2.x-dev

1.0.2.9999999-dev

PHP Swiss Knife - basic utilities for quick coding

  Sources   Download

GPL-3.0

The Requires

 

09/07 2017

1.0.1.x-dev

1.0.1.9999999-dev

PHP Swiss Knife - basic utilities for quick coding

  Sources   Download

GPL-3.0

The Requires

 

09/07 2017

1.0.0.x-dev

1.0.0.9999999-dev

PHP Swiss Knife - basic utilities for quick coding

  Sources   Download

GPL-3.0

The Requires