Some basic helpers when using with CodeIgniter 3.
Can be included in many other code sets or frameworks, however, there are some functions that require the CodeIgniter framework, however it does not affect the performance
In case of integrating this package into other frameworks, sources other than CodeIgniter, you need to install the nguyenanhung/polyfill-codeigniter-built-in package for best use
Some frameworks I often use with this package are
- CodeIgniter
- Slim framework
- FuelPHP
- PhalconPHP
- Laravel
- CodeIgniter Basic Helper
- Summary
- Table of Contents
- 1 số helper được hỗ trợ sẵn
- AlphaID Helper
- Array Helper
- Assets Helper
- Blogspot Helper
- Bytes Helper
- Chart Render Helper
- Common Helper
- Database Helper
- Date Helper
- Debug Helper
- ENV Helper
- Escape Helper
- Facebook Helper
- File Helper
- Form Helper
- Gravatar Helper
- HTML Helper
- Image Helper
- IP Helper
- Meta Helper
- Money Helper
- NanoID Helper
- Number Helper
- Paging Helper
- PlaceHolder Helper
- Request Helper
- Security Helper
- Sentry Helper
- String Helper
- Text Helper
- TinyUrl Helper
- URL Helper
- UUID Helper
- VN Province Helper
- Video Embed Helper
- XML Helper
- Simple RESTful Helper
- Simple cURL Helper
- Simple Image Library
- Maintainer & Supporter
Here is a list of supported Helpers in this library
- Helper Function: generateAlphaId - Function to generate a unique Id 4ew68i32xc based on an input int like 1234
- Helper Function: arrayToObject - Function to convert an array to an object
- Helper Function: to_array - Converts a string or an object to an array.
- Helper Function: arrayToXml - Function to help convert array into an XML string
- Helper Function: removeArrayElementWithValue - Remove 1 value in the array by key and value
- Helper Function: arrayRecursiveDiff - Diff 2 arrays recursively
- Helper Function: arrayIsAssoc - Detects if the given value is an associative array.
- Helper Function: arrayFirstElement - Returns the first element of an array.
- Helper Function: arrayLastElement - Returns the last element of an array.
- Helper Function: arrayGetElement - Gets a value in an array by dot notation for the keys.
- Helper Function: arraySetElement - Sets a value in an array using the dot notation.
- Helper Function: assets_url - Function to get Assets Url, condition for existence of assets folder in public/ folder.
In case in config.php file exists assets_version variable, it will automatically add version behind the files
CSS, JS
- Helper Function: static_url - Function to get Static Resource Url, condition for existence of config_item('static_url') configuration in website config. In case in config.php file exists assets_version variable, it will automatically add version behind the files
CSS, JS
- Helper Function: templates_url - Function to get Assets Url, condition for existence of templates folder in public/ folder. In case the config.php file contains the variable assets_version, it will automatically add the version behind the CSS, JS files
- Helper Function: editor_url - Function to get Assets Url, condition that the assets/editors/ folder exists in the public/ folder. In case the config.php file contains the variable assets_version, it will automatically add the version behind the CSS, JS files
- Helper Function: favicon_url - Function to get Assets Url, condition that the assets/favicon/ folder exists in the public/ folder. In case the config.php file contains the assets_version variable, it will automatically add the version behind the
CSS, JS files
- Helper Function: favicon_html_tag- Function to get the HTML segment representing the Favicon based on the input favicon folder URL
- Helper Function: storage_url - Need config storage_url item in config.php file. Example: $config['storage_url'] = 'https://storage.nguyenanhung.com/';
- Helper Function: go_url - Need config go_url item in config.php file. Eg: $config['go_url'] = 'https://go.nguyenanhung.com/';
- Helper Function: assets_mobile - Get the assets path of the mobile interface (rarely used, maintained for old projects)
- Helper Function: assets_themes - Get the assets path of the pc interface (rarely used, maintained for old projects)
- Helper Function: assets_themes_dashboard - Get the assets path of the dashboard interface (rarely used, maintained for old projects)
- Helper Function: assets_themes_comingsoon - Get the assets path of the coming soon interface (rarely used, maintained for old projects)
- Helper Function: assets_themes_error - Get the assets path of the error interface (rarely used, maintained for old projects) maintenance for old projects)
- Helper Function: cdn_js_url - JS, CSS resource from Cloudflare CDN
- Helper Function: google_fonts_url - Google Font resource
- Helper Function: bootstrapcdn_url - CDN resource from Bootstrap
- Helper Function: blogspotDescSortWithPublishedTime - Sort feed data from blogspot by Published Time
- Helper Function: blogspotUSort - Sort feed data from blogspot by USort and Published Time by DESC
- Helper Function: blogspotFormatInformationItem - Format input data blogspot item
- Helper Function: bytesHumanFormat - Display readable content format from data bytes
- Helper Function: bear_framework_default_get_data_chart
- Helper Function: bear_framework_default_get_data_chart_report
- Helper Function: isEmpty - Checks whether an input is empty
- Helper Function: defaultCompressHtmlOutput - Compresses HTML output, default configure
- Helper Function: generateRandomUniqueId - Generates a random Unique ID string, using UUID
- Helper Function: generateRandomNanoUniqueId - Generates a random Unique ID string, using NanoID
- Helper Function: generate_list_id_with_parent_id - Generates a list of IDs, containing dependent subsets of
that ID. Example: Used in case you want to display the content of the parent category and the child categories in the same page content
- Helper Function: dayFloor - Function to get the distance between 2 days
- Helper Function: getZuluTime - Function to get the date parameter according to Zulu time
- Helper Function: iso_8601_utc_time - Similar to the getZuluTime function
- Helper Function: getYesterday - Function to get the previous day
- Helper Function: smart_bear_date_range - Get an array of data containing dates according to the distance
- Helper Function: format_datetime_vn - Format the date information according to Vietnamese style
- Helper Function: get_start_and_end_date_for_week - Get the first and last days of a week
Các hàm này dùng debug
- Helper Function: dd
- Helper Function: ddd
- Helper Function: dump
- Helper Function: bear_get_env - Hàm lấy giá trị từ file .env
- Helper Function: bear_framework_basic_clean_str - Simple Clean Input String
- Helper Function: widget_facebook_div_init - Function to create <div id="fb-root"></div>
- Helper Function: widget_facebook_script_init - Function to create init script in case JS needs to be embedded
- Helper Function: widget_facebook_comments - Function to create facebook comment box
- Helper Function: widget_facebook_share_button - Function to create facebook share button
- Helper Function: widget_facebook_like_button - Function to create facebook like button
- Helper Function: widget_facebook_save_button - Function to create save content button to facebook
- Helper Function: formatSizeUnits - Function to format 1 input int into 1 format for easy read file size
- Helper Function: generateFileIndex - Automatically generate the content of the file index.html
- Helper Function: generateFileHtaccess - Automatically generate the content of the file .htaccess
- Helper Function: generateFileReadme - Automatically generate the content of the file README.md
- Helper Function: makeNewFolder - The function creates a new folder and generates 3 files in it: README.md, index.html , .htaccess. Create additional .gitkeep file if the second parameter passed is true
- Helper Function: new_folder - Similar function to makeNewFolder
- Helper Function: scan_folder - Scan and get list of data information in folder
- Helper Function: getAllFileSizeInFolder - Get all File size in Folder
- Helper Function: getAllFileInFolder - Get all File in Folder
- Helper Function: join_value_multiple - Join Value Multiple
- Helper Function: bear_framework_show_gravatar - Show Gravatar URL with Custom Size and Username
- Helper Function: meta_dns_prefetch
- Helper Function: meta_property
- Helper Function: tachPage
- Helper Function: stripHtmlTag
- Helper Function: strip_only_tags
- Helper Function: tracking_google_analytics
- Helper Function: tracking_google_gtag_analytics_default
- Helper Function: bear_framework_show_jsonld_script
- Helper Function: google_image_resize - Resize Image using Google Gadget Proxy
- Helper Function: google_image_proxy_dns_prefetch - Function to provide DNS Prefetch in case of using google_image_resize
- Helper Function: wordpress_proxy - Resize & Cache Image using WordPress Proxy
- Helper Function: wordpress_proxy_dns_prefetch - Function to provide DNS Prefetch in case of using wordpress_proxy
- Helper Function: bear_framework_image_url - Function to format Image Url - specific to BEAR framework
- Helper Function: create_image_thumbnail - Function to create thumbnail - specific to BEAR framework
- Helper Function: getIPAddress - Function to get the user's actual IP address
- Helper Function: getIPAddressByHaProxy - Function to get the user's actual IP address but on the server running Ha Proxy, through the variable HTTP_X_FORWARDED_FOR
- Helper Function: validateIP - Function to validate whether a string is an IP. TRUE if it is an IP
- Helper Function: validateIPV4 - Function to validate whether a string is an IP v4. TRUE if it is an IP
- Helper Function: validateIPV6 - Function to validate whether a string is an IP v6. TRUE if it is an IP
- Helper Function: getIpInformation - Initiate a request to IP-API to get information about the IP address
- Helper Function: setupMetaDnsPrefetch - Function to generate a similar HTML Dns Prefetch segment
- Helper Function: money_number_format - format money currency will detect the current locale
This helper uses the hidehalo/nanoid-php package to generate a random Id code that is small, lightweight and much safer than UUID.
Currently, using nanoid is a trend compared to traditional uuid
To use this package, you need to install the nguyenanhung/nanoid-helper package by command composer require nguyenanhung/nanoid-helper
- Helper Function: randomNanoId
- Helper Function: convertNumberToWords - Effect of converting a number into words, for example 123 to One Hundred Twenty Three
- Helper Function: view_paginations
- Helper Function: view_more
- Helper Function: select_page
- Helper Function: get_paginations_title
- Helper Function: get_paginations_number
- Helper Function: bear_framework_news_view_pagination - Pagination function specifically for BEAR Project
- Helper Function: placeholder_img
- Helper Function: sendSimpleGetRequest - Execute a simple request using CURL with GET method
- Helper Function: sendSimpleRestfulExecuteRequest - Execute a simple request to Restful API using CURL
- Helper Function: bear_post_async_request - Make an asynchronous POST request - Execute asynchronous POST request within the site without waiting for a response => No impact, no delay in the running process
- Helper Function: get_http_response_code - Get HTTP Response Code with get_headers
- Helper Function: xssValidation - Validate whether the input data is vulnerable to XSS or not. This function does not have an escape function, if you want, install the package nguyenanhung/security
- Helper Function: log_to_sentry - Logging to Sentry via Monolog Handler
- Helper Function: countStringsInText - Function to count the number of words in a text paragraph
- Helper Function: findMiddleInString - Function to get the string between the start string and the end string
- Helper Function: str_insert - Inserts one or more strings into another string on a defined position.
- Helper Function: str_between - Return the content in a string between a left and right element.
- Helper Function: str_after - Return the part of a string after a given value.
- Helper Function: str_before - Get the part of a string before a given value.
- Helper Function: str_limit_words - Limit the number of words in a string. Put value of $end to the string end.
- Helper Function: str_limit_characters - Limit the number of characters in a string. Put value of $end to the string end.
- Helper Function: str_contains - Tests if a string contains a given element
- Helper Function: str_ignore_contains - Tests if a string contains a given element. Ignore case sensitivity.
- Helper Function: str_starts_with - Determine if a given string starts with a given substring.
- Helper Function: str_ignore_starts_with - Determine if a given string starts with a given substring. Ignore case sensitivity.
- Helper Function: str_ends_with - Determine if a given string ends with a given substring.
- Helper Function: str_ignore_ends_with - Determine if a given string ends with a given substring. Ignore case sensitivity.
- Helper Function: str_after_last - Return the part of a string after the last occurrence of a given search value.
- Helper Function: hide_characters - Convert nguyenanhung to ngxyexanxunx, acts as a very simple and predictable character encoding function but is necessary to hide something simple
- Helper Function: convert_string_utf8_to_vietnamese
- Helper Function: clean_allowfullscreen
- Helper Function: clean_text
- Helper Function: clean_title
- Helper Function: clean_text_mobile
- Helper Function: bodautru
- Helper Function: bodaunhay
- Helper Function: searchs_snippets
- Helper Function: tags_snippets
- Helper Function: tags_clean
- Helper Function: highlight_keyword_phrase - Highlights a keyword within a text string
- Helper Function: format_keyword_highlight_phrase - Format Keyword for Function highlight_keyword_phrase
- Helper Function: short_url_with_tinyurl - ShortUrl helper function based on TinyURL API
- Helper Function: encodeId_Url_byHungDEV
- Helper Function: decodeId_Url_byHungDEV
- Helper Function: convertToLatin
- Helper Function: specialCharToNormalChar
- Helper Function: alphabetOnly
- Helper Function: boDauTiengViet
- Helper Function: removeSpecialChar
- Helper Function: getPermalinksSEO
- Helper Function: share_url - Create standard sharing URL for social networks, very good support for SEO
- Helper Function: private_url - Customize function specifically for CodeIgniter framework
- Helper Function: private_api_url - Customize function specifically for CodeIgniter framework
- Helper Function: cdn_url - Customize function specifically for CodeIgniter framework
- Helper Function: images_url - Customize function specifically for CodeIgniter framework
- Helper Function: audio_url - Customize function specifically for CodeIgniter framework
- Helper Function: append_params_into_url - Append parameters to URL
- Helper Function: append_query_string_to_current_url - Get current URL including query string - Customize function specific to CodeIgniter framework
- Helper Function: generate_uuid_v4 - Function to generate a random v4 UUID string
- Helper Function: check_vn_province_code - Check Provin Code of some provinces in Vietnam
- Helper Function: convert_video_embed_vimeo - Convert Video URL to Embed Vimeo (rarely used, save here because there are still many old projects using it)
- Helper Function: convert_video_embed_dailymotion - Convert Video URL to Embed DailyMotion (rarely used, save here because there are still many old projects using it)
- Helper Function: convert_video_embed_youtube - Convert Video URL to Embed YouTube (rarely used, save here because there are still many old projects using it)
- Helper Function: convert_video_v_embed_youtube - Convert Video URL to Embed YouTube (rarely used, save here because there are still many old projects using it)
- Helper Function: youtube_image_thumbnail - Convert YoutubeID to Youtube Thumbnail URL
- Helper Function: parse_sitemap - Support function to render content for Sitemap
- Helper Function: parse_sitemap_index - Support function to render content for Sitemap Index
- Helper Function: xml_convert - Convert Reserved XML characters to Entities
- Helper Function: xml_get_value - Get Value from XML string
- Helper Function: xml_to_json - Convert XML string to JSON
Class provides a quick way to call RESTful APIs
- Execute request to RESTful API Service: SimpleRestful::execute($url, $type, $data)
Class provides a quick way to call to make external requests, using simple Curl, for example
Class provides some methods to help process images
- Method googleGadgetsProxy - Create Resize URL using Google Gadgets Proxy
- Method googleGadgetsProxyDnsPrefetch - Setup DNS Prefetch for Google Gadgets Proxy, to increase query speed
- Method wordpressProxy - Create Resize URL using WordPress Proxy
- Method wordpressProxyDnsPrefetch - Setup DNS Prefetch for WordPress Proxy, to increase query speed
- Method createThumbnail - Thumbnail creation function, to use it, you need to install the package nguyenanhung/image
- Method createThumbnailWithCodeIgniterCache - Thumbnail creation function combined with CodeIgniter Cache library, to use it, you need to install the package nguyenanhung/image