Tag: php

Validate BAD Emails in PHP, Laravel

DebuggingDevelopmentLaravelLaravel 5PHPTesttingUncategorizedbad_emailsEmailLaravelphpskpaulskpaul82validate_bad_emailvalidation

Hey! what’s up? I am working on a SAAS application for my current company (Prithibi Consulting Services) and facing the issue of sending emails, actually bad emails, those comply with the RFC. So that means basic email validation is not working from the Laravel side and we are processing emails to ‘example@gmail’ like email addresses ….  Read More

How to define Global Variable or Constant in Laravel

DevelopmentLaravelLaravel 5PHPGlobal ConstantGlobal VariableLaravel 5.2phpskpaulskpaul82

We often need to define global variables/constants for our application, like Status, Conditions, Countries (we can put all countries in table as it will be along array/object), also weekdays, weekends and e.t.c. vary on projects. Status (Active, Inactive) and Conditions (Ok, Good, Better, Best) or Grade (F, C, D, A, A-, A+), so like these ….  Read More

How to find src attribute of image tag in php?

PHPRegexextracthtmlimageimage srcimgphpregexsk_paulskpaul82

In my case, I had a string containing exactly one <img /> tag (and no other markup). And I was trying to get the src attribute. // get the featured image $image = ‘<img src=”path/to/image_file” />’; // get the src for that image $pattern = ‘/src=”([^”]*)”/’; preg_match($pattern, $image, $matches); $src = $matches[1]; unset($matches); In the ….  Read More