Thursday, 19 May 2022

PHP Regex Sample Code

A regular expression (shortened as regex or regexp or rational expression) is a sequence of characters that specifies a search pattern in the text.A good testing site is https://infoheap.com/php-preg_match-online/ Examples of regex for passwordPHP Version/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z])(?=\S*[\W]).{8,}$/Must have special characters(?=\S*[\W])Must have a number(?=.*\\d)Must...
Share:

Friday, 22 April 2022

Tuesday, 8 March 2022

Wednesday, 9 February 2022

Changing .env Programatically

With great powers comes great responsibility, changing .env values in the server were great but if you don't have access to it this code might come in handy. In your route, where key is the key, and value will be the new env value Route::get('changeenv/{key?}/{value?}',"controller@methodname"); In your controller public function changeEnv($key, $value) { $path = app()->environmentFilePath(); ...
Share:

Tuesday, 8 February 2022

Laravel SMTP Settings for Different Mail Service Provider

Laravel SMTP Settings for Different Mail Service Provider MAILHOG brew update && brew install mailhog For Laravel .env MAIL_DRIVER=smtp MAIL_HOST=0.0.0.0 MAIL_PORT=1025 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null Run in Terminal mailhog Testing Email Open this link Mailhog UIJust continue sending em...
Share:

Monday, 7 February 2022

Makefile miscellaneous commands

Some miscellaneous commands for makefile This command will cd to a page and run command inside the page, if successful succeeding commands will be called. build:adminx font js js: npm run build font: npm run gulp iconfont adminx: cd admin; npm run build ...
Share:

Monday, 31 January 2022

Thursday, 27 January 2022

PHP Google GeoCoding Getting Latitude & Longitude

private function getGeoLocation($address) { try { $url = 'https://maps.google.com/maps/api/geocode/json'; $address = str_replace(["'", '"'], " ", $address); $address = str_replace([" ", " "], "+", $address); $query_array = array( 'address' => $address, 'key' => env('GOOGLE_MAP_API_KEY') ); $query = http_build_query($query_array);...
Share:

Popular Posts

Recent Posts

Pages

Powered by Blogger.

About Me

My photo
For the past 10 years, I've been playing with codes using PHP, Java, Rails. I do this for a living and love new things to learn and the challenges that comes with it. Besides programming I love spending time with friends and family and can often be found together catching the latest movie or planning a trip to someplace I've never been before.