CodeIgniter - Basic Helper - Maintain by @nguyenanhung
GPL-3.0 License
1 vi helper c bn khi s dng vi CodeIgniter 3.
C th a vo nhiu b code hay framework khc, tuy nhin c 1 s function require framework CodeIgniter
, tuy nhin
khng nh hng ti hiu sut s dng
Trong trng hp tch hp gi ny vo cc framework, source khc ngoi CodeIgniter
, bn cn ci km thm
gi nguyenanhung/polyfill-codeigniter-built-in
s dng tt nht
1 vi framework ti cng thng dng vi gi ny l
Di y l danh sch cc Helper c h tr trong b th vin ny
generateAlphaId
- Hm gip to 1 Id unique 4ew68i32xc
da trn 1 int u vo nh 1234
arrayToObject
- Hm gip chuyn 1 array thnh 1 objectto_array
- Converts a string or an object to an array.arrayToXml
- Hm gip chuyn array thnh 1 chui XMLremoveArrayElementWithValue
- Loi b 1 gi tr trong array theo key v valuearrayRecursiveDiff
- Diff 2 array bng quyarrayIsAssoc
- Detects if the given value is an associative array.arrayFirstElement
- Returns the first element of an array.arrayLastElement
- Returns the last element of an array.arrayGetElement
- Gets a value in an array by dot notation for the keys.arraySetElement
- Sets a value in an array using the dot notation.assets_url
- Hm ly ra Assets Url, iu kin tn ti th mc assets
trong th mc public/
.config.php
tn ti bin assets_version
s t ng thm version vo ng sau cc filestatic_url
- Hm ly ra Static Resource Url, iu kin tn ti cuconfig_item('static_url')
trong config ca website. Trong trng hp trong file config.php
tn tiassets_version
s t ng thm version votemplates_url
- Hm ly ra Assets Url, iu kin tn ti th mc templates
trong thpublic/
. Trong trng hp trong file config.php
tn ti bin assets_version
s t ng thm version vo ngeditor_url
- Hm ly ra Assets Url, iu kin tn ti th mc assets/editors/
trong thpublic/
. Trong trng hp trong file config.php
tn ti bin assets_version
s t ng thm version vo ngfavicon_url
- Hm ly ra Assets Url, iu kin tn ti th mc assets/favicon/
trong thpublic/
. Trong trng hp trong file config.php
tn ti bin assets_version
s t ng thm version vo ngfavicon_html_tag
- Hm ly ra on HTML th hin Favicon da vo URL folder favicon u vostorage_url
- Need config storage_url
item in config.php file.$config['storage_url'] = 'https://storage.nguyenanhung.com/';
go_url
- Need config go_url
item in config.php
file.$config['go_url'] = 'https://go.nguyenanhung.com/';
assets_mobile
- Ly ra ng dn assets ca giao din mobile (thc t t dng, duy tr cho ccassets_themes
- Ly ra ng dn assets ca giao din pc (thc t t dng, duy tr cho cc dassets_themes_dashboard
- Ly ra ng dn assets ca giao din dashboard (thc t t dng, duyassets_themes_comingsoon
- Ly ra ng dn assets ca giao din coming soon (thc t t dng,assets_themes_error
- Ly ra ng dn assets ca giao din error (thc t t dng, duy tr chocdn_js_url
- Resource JS, CSS t CDN ca Cloudflaregoogle_fonts_url
- Resource Google Fontbootstrapcdn_url
- Resource CDN t BootstrapblogspotDescSortWithPublishedTime
- Sp xp d liu feed t blogspot theo Published TimeblogspotUSort
- Sp xp d liu feed t blogspot theo USort v Published Time theo DESCblogspotFormatInformationItem
- Format d liu u vo blogspot itembytesHumanFormat
- Hin th format ni dung d c t byte d liubear_framework_default_get_data_chart
bear_framework_default_get_data_chart_report
isEmpty
- Kim tra 1 input u vo xem c phi l rng hay khngdefaultCompressHtmlOutput
- Compress HTML output, default configuregenerateRandomUniqueId
- To 1 chui Unique ID ngu nhin, s dng UUIDgenerateRandomNanoUniqueId
- To 1 chui Unique ID ngu nhin, s dng NanoIDgenerate_list_id_with_parent_id
- To 1 list cc ID, trong cha cc tp con ph thuc cadayFloor
- Hm ly ra khong cch gia 2 ngygetZuluTime
- Hm ly ra tham s date theo Zulu timeiso_8601_utc_time
- tng t hm getZuluTimegetYesterday
- Hm y ra ngy trc lin ksmart_bear_date_range
- Ly ra 1 mng d liu cha cc ngy theo khong cchformat_datetime_vn
- Format li thng tin ngy theo kiu Vit Namget_start_and_end_date_for_week
- Ly ra ngy u v ngy cui ca 1 tunCc hm ny dng debug
dd
ddd
dump
bear_get_env
- Hm ly gi tr t file .envbear_framework_basic_clean_str
- Simple Clean Input Stringwidget_facebook_div_init
- Hm to ra <div id="fb-root"></div>
widget_facebook_script_init
- Hm to ra on script init trong trng hp cn nhng JSwidget_facebook_comments
- Hm to ra khung comment facebookwidget_facebook_share_button
- Hm to ra nt share facebookwidget_facebook_like_button
- Hm to ra nt like facebookwidget_facebook_save_button
- Hm to ra nt lu ni dung vo facebookformatSizeUnits
- Hm format 1 int u vo thnh 1 format d c dung lng filegenerateFileIndex
- T ng to ni dung file index.html
generateFileHtaccess
- T ng to ni dung file .htaccess
generateFileReadme
- T ng to ni dung file README.md
makeNewFolder
- Hm to 1 th mc mi v generate sn trong 3 file: README.md
, index.html
.htaccess
. To thm file .gitkeep
nu tham s th 2 c truyn l truenew_folder
- Chc nng tng t vi hm makeNewFolder
scan_folder
- Qut v ly ra danh sch cc thng tin d liu trong foldergetAllFileSizeInFolder
- Get all File size in FoldergetAllFileInFolder
- Get all File in Folderjoin_value_multiple
- Join Value Multiplebear_framework_show_gravatar
- Show Gravatar URL with Custom Size and Usernamemeta_dns_prefetch
meta_property
tachPage
stripHtmlTag
strip_only_tags
tracking_google_analytics
tracking_google_gtag_analytics_default
bear_framework_show_jsonld_script
google_image_resize
- Resize Image s dng Google Gadget Proxygoogle_image_proxy_dns_prefetch
- Hm cung cp DNS Prefetch trong trng hp sgoogle_image_resize
wordpress_proxy
- Resize & Cache Image s dng WordPress Proxywordpress_proxy_dns_prefetch
- Hm cung cp DNS Prefetch trong trng hp swordpress_proxy
bear_framework_image_url
- Hm format Image Url - dnh ring cho BEAR frameworkcreate_image_thumbnail
- Hm create thumbnail - dnh ring cho BEAR frameworkgetIPAddress
- Hm ly ra a ch IP thc t ca ngi dnggetIPAddressByHaProxy
- Hm ly ra a ch IP thc t ca ngi dng nhng server c chy HaHTTP_X_FORWARDED_FOR
validateIP
- Hm validate 1 string c phi IP ko. TRUE nu l IPvalidateIPV4
- Hm validate 1 string c phi IP v4 ko. TRUE nu l IPvalidateIPV6
- Hm validate 1 string c phi IP v6 ko. TRUE nu l IPgetIpInformation
- Khi to 1 request n IP-API
ly thng tin ca a ch IPsetupMetaDnsPrefetch
- Hm h tr gen ra 1 on HTML Dns Prefetch tng<link href='//data.nguyenanhung.com/' rel='dns-prefetch' />
money_number_format
- format money currency will detect the current localeHelper ny s dng gi hidehalo/nanoid-php
gen ra 1 m random Id nh, nh v an ton hn nhiu so vi UUID.
Hin ti vic s dng nanoid ang l xu hng so vi uuid truyn thng
s dng c gi ny, cn ci packages nguyenanhung/nanoid-helper
bng
lnh composer require nguyenanhung/nanoid-helper
randomNanoId
convertNumberToWords
- Tc dng convert 1 s thnh ch, v d 123
One Hundred Twenty Three
view_paginations
view_more
select_page
get_paginations_title
get_paginations_number
bear_framework_news_view_pagination
- Hm phn trang ch ring cho BEAR Projectplaceholder_img
sendSimpleGetRequest
- Tin hnh thc thi 1 request n gin s dng CURL vi phng thc GETsendSimpleRestfulExecuteRequest
- Thc thi 1 simple request ti Restful API s dng CURLbear_post_async_request
- Make an asynchronous POST request - Thc hin yu cu POST khng ngget_http_response_code
- Get HTTP Response Code with get_headers
xssValidation
- Validation d liu u vo c b dnh li XSS hay khng. Hm ny khng c tcnguyenanhung/security
log_to_sentry
- Logging ln Sentry thng qua Monolog HandlercountStringsInText
- Hm m s t trong on vn bnfindMiddleInString
- Hm ly chui gia chui bt u v chui kt thcstr_insert
- Inserts one or more strings into another string on a defined position.str_between
- Return the content in a string between a left and right element.str_after
- Return the part of a string after a given value.str_before
- Get the part of a string before a given value.str_limit_words
- Limit the number of words in a string. Put value of $end to the string end.str_limit_characters
- Limit the number of characters in a string. Put value of $end to thestr_contains
- Tests if a string contains a given elementstr_ignore_contains
- Tests if a string contains a given element. Ignore case sensitivity.str_starts_with
- Determine if a given string starts with a given substring.str_ignore_starts_with
- Determine if a given string starts with a given substring. Ignore casestr_ends_with
- Determine if a given string ends with a given substring.str_ignore_ends_with
- Determine if a given string ends with a given substring. Ignore casestr_after_last
- Return the part of a string after the last occurrence of a given search value.hide_characters
- Convert nguyenanhung
to ngxyexanxunx
, acts as a very simple andconvert_string_utf8_to_vietnamese
clean_allowfullscreen
clean_text
clean_title
clean_text_mobile
bodautru
bodaunhay
searchs_snippets
tags_snippets
tags_clean
highlight_keyword_phrase
- Highlights a keyword within a text stringformat_keyword_highlight_phrase
- Format Keyword for Function highlight_keyword_phrase
short_url_with_tinyurl
- Hm h tr shortUrl da trn API ca TinyURLencodeId_Url_byHungDEV
decodeId_Url_byHungDEV
convertToLatin
specialCharToNormalChar
alphabetOnly
boDauTiengViet
removeSpecialChar
getPermalinksSEO
share_url
- Create ra URL share chun cho cc MXH, h tr rt tt cho SEOprivate_url
- Hm customize dnh ring cho framework CodeIgniterprivate_api_url
- Hm customize dnh ring cho framework CodeIgnitercdn_url
- Hm customize dnh ring cho framework CodeIgniterimages_url
- Hm customize dnh ring cho framework CodeIgniteraudio_url
- Hm customize dnh ring cho framework CodeIgniterappend_params_into_url
- Append parameters to URLappend_query_string_to_current_url
- Get current URL including query string - Hm customizegenerate_uuid_v4
- Hm to ra 1 chui UUID v4 ngu nhincheck_vn_province_code
- Check Provin Code ca 1 s tnh thnh Vit Namconvert_video_embed_vimeo
- Convert Video URL to Embed Vimeo (t dng, lu ti y v cn nhiuconvert_video_embed_dailymotion
- Convert Video URL to Embed DailyMotion (t dng, lu ti yconvert_video_embed_youtube
- Convert Video URL to Embed YouTube (t dng, lu ti y v cnconvert_video_v_embed_youtube
- Convert Video URL to Embed YouTube (t dng, lu ti y v cnyoutube_image_thumbnail
- Convert YoutubeID to Youtube Thumbnail URLparse_sitemap
- Hm h tr render ra ni dung cho Sitemapparse_sitemap_index
- Hm h tr render ra ni dung cho Sitemap Indexxml_convert
- Convert Reserved XML characters to Entitiesxml_get_value
- Get Value from XML stringxml_to_json
- Convert XML string to JSONClass cung cp phng thc nhanh gn gi ti cc API tun chun RESTful
SimpleRestful::execute($url, $type, $data)
Class cung cp phng thc nhanh gn gi thc hin cc request ra bn ngoi, s dng Curl n gin, v d
<?php
use nguyenanhung\CodeIgniter\BasicHelper\SimpleCurl;
$curl = new SimpleCurl();
$curl->setUrl('https://example.com')
->setPost(array('field1'=>'value1'))
->createCurl();
$response = $curl->getResponse();
Class cung cp 1 s phng thc gip x l hnh nh
googleGadgetsProxy
- To URL Resize s dng Google Gadgets ProxygoogleGadgetsProxyDnsPrefetch
- Setup DNS Prefetch cho Google Gadgets Proxy, nhm tng tc truy vnwordpressProxy
- To URL Resize s dng WordPress ProxywordpressProxyDnsPrefetch
- Setup DNS Prefetch cho WordPress Proxy, nhm tng tc truy vncreateThumbnail
- Hm to Thumbnail, s dng cn ci thm gi nguyenanhung/image
createThumbnailWithCodeIgniterCache
- Hm to Thumbnail kt hp th vin Cache ca CodeIgniter, snguyenanhung/image
STT | Name | Website | Github | |
---|---|---|---|---|
1 | Hung Nguyen | [email protected] | https://nguyenanhung.com | @nguyenanhung |