Showing 1 to 5 of 24 blog articles.
1312 views · 66 days ago

![Creating a Virus with PHP](

In his talk, “[Writing Viruses for Fun, Not Profit](,” **[Ben Dechrai](** (after making the viewer take a pledge to only use this knowledge for good and not evil) walks through how many viruses operate, and just how easy it is to build your own self-replicating virus in PHP.

The danger of many of these viruses according to Ben is that the most dangerous viruses often escape detection by not looking like a virus. Instead they encrypt their code to hide their true intent, while also constantly adapting and evolving.

Perhaps even more dangerously, they act like they’re benign and don’t actually do anything - often times laying dormant until called upon by the malicious actor.

### Crea...

1269 views · 32 days ago

![Working With Thin Controller And Fat Model Concept In Laravel](

Models and controllers are one of the most essential programming handlers in the Laravel MVC framework, and both are used vastly for different functional operations. Models in Laravel are created inside the app folder and are mostly used to interact with the database using Eloquent ORM, while the controllers are located inside the directory App/Http/Controllers.

As a programmer, you should have the knowledge how to keep the balance in between the programming usage of Models and controllers. As which one should be more utilized for allowing functional tasks in applications deployed on any [PHP MySQL hosting](

## What is the Concept of Thin Controller and FAT Models

The concept of ...

1067 views · 83 days ago

![Type Arrays with Variadic Functions in PHP](

It's a very common task to work with an array of values, each of the same type. Integers, strings, all kinds of objects etc. But PHP is still a weakly typed language, so it's hard to tell if an arbitrary array actually contains only values of a given type.

Of course, you can always use a class:


class IntArray {

private $values = [];

public function add(int $value) {

$this->values[] = $value;




Then, whenever you need an array of integers, you may write something like this:


class BatchProcessor


private $ids;

public function __construct(IntArray $ids) {

$this->ids = $ids;




Not bad. You'll need a class per type, though, and that may seem a bi...

929 views · 33 days ago

![Custom extension to Laravel Application class](

Hello folks! This post is for those of you using Laravel. This beautiful framework makes web development super-easy compared to most of competitors. In the heart of Laravel is the Application class, which is responsible for bootstrapping, registering services and also serves as a dependency injection container. What I do with my Laravel apps, is that I take a slight detour from the common path by adding a custom Application class. While this is not really necessary, I find this approach nice, and will try to share my thought below.

It's normal practice in Laravel world to build all kinds of objects like this:


$cache = app("cache");


I find it a bit confusing to call `app("cache"")` and expect a `Cache\Repository` instance as result....

887 views · 33 days ago

![Generate PDF from HTML in Laravel 5.7](

Today, I will share with you how to create a PDF file from HTML blade file in Laravel 5.7. We will be using `dompdf` package for generating the PDF file.

In the below example, we will install `barryvdh/laravel-dompdf` using composer package and thereafter we will add new route url with controller. Then we will create a blade file. Then after we have to just run project with serve and we can check the PDF file is for download.

## Download Laravel 5.7

Now I am going to explain the step by step from scratch with laravel installation for `dompdf`. To get started, we need to download fresh Laravel 5.7 application using command, so open our terminal and run the below command in the command prompt:


composer create-project --prefer-dist laravel/lara...