Download the PHP package maksuco/helpers without Composer
On this page you can find all versions of the php package maksuco/helpers. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download maksuco/helpers
More information about maksuco/helpers
Files in maksuco/helpers
Package helpers
Short Description A bunch of functions that can help
License MIT
Informations about the package helpers
Helpers
This package has a few php helpers, for everyday tasks
Installation
This packages requires Spatie/Analytics for the charts You can install the package via composer:
This Package works with auto discovery in Laravel +5.5, but is compatible with older versions
Usage
Device check: Mobile, Tables, Desktop
Response with the correct device, example: (300,'table',200), the response is 300 when is mobile OR 200 if it's desktop. ('mobile','table','desktop')
Check if device is Mobile
Check browser locale
Returns the browser locale, for example 'en', you send the available languages of your site, the first one is the base
Check if device is Mobile, Operating System and Browser
Check if visitor is a bot
Avatar
This function helps you show the user avatar or the gravatar, just send the user array or email. It returns the image path or base64
First Name
Helps you show the user first name, from a full name, max length of the returned name is 11
Name Initials
Crypto
Here's an example of how to implement crypto to transform strings to hashed keys, using 2 security keys: one set in the config.app (crypto_string) and another inside the controller, example the $user->id:
Active Navigation Page
Send the current page name, example 'about' or 'contactenos', it checks if theres a variable named $active (send from the controller) then checks if the route has a name and then checks the first segment of the page, example: about/history
Text parser
Convert plain text to include real html links (blank is optional, default is true)
Find text between 2 strings or replace
Returns an array with all results
Get all countries
A list of countries to show in a select
Get all cities by country
A list of cities in country
Check continent
Returns the continent by name, simplify returns Europe if eu or america if anything else
Get all timezones
A list of timezones to show in a select
Get all languages or lang code name
Get all currencies or currency details for echo
A list of countries to show in a select or currency details like symbol, decimals, name, etc..
Money Format
Currency Money Exchange
Decimal Format
Useful for saving numbers on mysql decimal columns
Location GEOIP
Get the city, country, language and other data from the IP: This product includes GeoLite2 data created by MaxMind, available from https://www.maxmind.com also requires composer require maksuco/helpers-geo. https://github.com/maxmind/GeoIP2-php Even better you can use 'ip-api' or 'ipstack' (ipstack requires a third argument for the ipstack key or IPSTACK_KEY=xxx on .env file - laravel)
if you need the function to provide the ip, just put null in the $ip. if you also want the isp info, just include the second call.
Date in IP TimeZone
Location distance between 2 points
The units is optional, default is "miles"
Append to json (only works with first level for now)
Send new data to append to a json data or subcategory (subcategory and limit are optional).
You send the DB column as $json, the new object or array as $new.
LImit, sets a limit for the amounts of records
Modify csv string action=add,remove,check
Send id's to add, remove or check if exist in csv string
Modify array with action=add,remove,check
Send new data to add, remove, check if exist in array or invert Works with Sequential and Associative arrays Invert adds the new if doesn't exist, or removes it if exist and returns the action "added" or "removed"
Collection Relations Append
Include in a collection the columns from another table with just one extra query $principal_relation_column = the principal reference INT, typically id (This is optional)
Examples: ($user,$post,'user_id',['post_name'=>'name'])
Column: Array and Json check
Check if a value is in a column (Works with json, array and string explode) //only 1 level RETURNS: true or false
Column Process (if is in column, it will delete it, if not it will add it)
Links
Check if a domain doesn't have the http and adds it, and other links, domains helpers
Get Domain from email
Get Domain from url
Get html sections from url
You need the dom extension https://stackoverflow.com/questions/14395239/class-domdocument-not-found
Transform number to telto number
GET video id of youtube or vimeo link, if is already is returns the same
Email and Domain Check
Get file type
File size to bytes calculator
Send '1 mb' and get the result in bytes, send measurements in: b, kb, mb, gb, tb
Generate random string
Send the length of the random
Generate random name
Names for testing, send 'name', 'lastname' or 'fullname' or leave empty for fullname
Generate random quote
Hide part of the string like an api_key
Greetings by time of day
Returns good afternoon, good morning etc.. (timezone is optional)
Day name by day difference
Returns today, tomorrow, 10 days a go, etc...
Filename Parsing
Get a filename name from a string or url, you can also parse it and get basename, extension and filename
Slugs
Here's an example of how to implement the slug function to transform names to slugs:
Transform file names, the second argument specifies a random addon at the end, can be text or INT
In this function you can specify a new filename (REPLACE) and use the same extension
Here's an example of how to implement the random function, Adds random at the end of the file name, and checks if its numeric or string
Here's an example of how to implement the random function, Adds random at the end of the file name, and checks if its numeric or string
Code
Help with pre and code content
Social Sharing
$url can be null to automatically get the current url page
Facebook Share
$app_id is optional
Twitter Share
$username is optional
LinkedIn Share
$username is optional
Pinterest Share
$image is optional
Whatsapp Share
Whatsapp Chat
ADD POPUP INSTEAD OF target="_blank"
Just add to the link onclick="return popup(this);"
GET CURRENT PAGE URL
MINIFY HTML
PROCESS INSTAGRAM SCRAPER
Requires https://github.com/postaddictme/instagram-php-scraper composer require raiym/instagram-php-scraper