Skip to content

Instantly share code, notes, and snippets.

View azazqadir's full-sized avatar

Muhammad Azaz Qadir azazqadir

  • Karachi, Pakistan
View GitHub Profile
@azazqadir
azazqadir / index.php
Created February 2, 2018 14:08
Realtime chat application created in PHP using Pusher: https://www.cloudways.com/blog/real-time-chat-app-php/
<!DOCTYPE html>
<head>
<title>Pusher Test</title>
<link rel="stylesheet" type="text/css" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js" type="text/javascript" ></script>
<script src="https://js.pusher.com/4.1/pusher.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js" type="text/javascript" ></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.3.0/bootbox.min.js" type="text/javascript" ></script>
@azazqadir
azazqadir / readme.md
Created February 20, 2018 13:00
Developing a Multilingual Site in CodeIgniter

Specify Default Language and Language Options

Go to application/config folder and open config.php. Add the following line to specify the website’s default language.

$config['language']  = 'english';
$config['language']  = 'english';
@azazqadir
azazqadir / laravel-model-view.md
Created March 9, 2018 14:06
Learn more about Models and View in Laravel 5.5

In Laravel, models are created inside the app folder. Models are mostly used to interact with the database using Eloquent ORM. Eloquent provides simple ActiveRecord implementations for database interaction.

The easiest way to create a model is the Artisan command:

php artisan make:model <model name>

Views in Laravel are created in the resources/views folder. You can change base path for views by editing config/view.php file and changing realpath(base_path('resources/views')) to the new location for the views.

Get Necessary Packages Let’s get the necessary classes we will require to make things possible. I’ll be using Composer to bring down the packages:

$ composer requireanhskohbo/no-captcha

Set up Configurations We are going to edit the app.php file.

@azazqadir
azazqadir / deployphpapplication.md
Created April 9, 2018 15:11
Using Envoyer for PHP App Deployment

Envoyer is a great tool for deploying PHP Applications with zero downtime on your server.

Step 1: Create Envoyer Account and Add a Project

Step 2: Connect to a Repository on Github, Bitbucket or any other self-hosted repository

Step 3: Head to the server tab and click the add server button.

Step 4: Deploy your application

@azazqadir
azazqadir / readme.md
Created May 14, 2018 09:51
Creating a Connection Between MySQL and PHP

This tutorial guides you how to connect MySQL database with PHP. To establish the connection, you can simply do it with MySQL or you can use MySQLi or PDO (PHP Data Objects).

For MySQL, simply add followin code in db_connection.php file in your root.

<?php

function OpenCon()
 {
 $dbhost = "localhost";
@azazqadir
azazqadir / readme.md
Created May 17, 2018 09:45
Enable SSL Certificate on Custom PHP website

To enable SSL on PHP, you need to install the SSL certificate. If you are doing it using Cloudways, then you can either enable Free SSL by Let's Encrypt on one click from the settings or install custom SSL.

<Files ~ "^\.(htaccess|htpasswd)$">
deny from all
@azazqadir
azazqadir / readme.md
Created June 26, 2018 13:44
PHP 5.6 Performance Benchmarks Compared with PHP 7 on Laravel 5.4

When tested Laravel 5.4 on PHP 5 vs 7 for performance benchmark, the latter was 50% faster than the previous version. With PHP 5.4, the response time was 553ms, whereas with PHP 7 it was 274ms. This is enough to prove that it is time to start upgrading to PHP 7 and make websites load faster.

@azazqadir
azazqadir / readme.md
Created August 6, 2018 10:45
Symfony 4 Installation Command

Use the following composer command to install Symfony 4

composer create-project symfony/skeleton symfony4

Flex is now included as a dependency in the new version. You can easily create a new Symfony 4 skeleton projects with Flex enabled.

@azazqadir
azazqadir / readme.md
Created August 23, 2018 17:44
Integration of React in Symfony

Here is a detailed step by step guide on integrating react in Symfony using pure javascript library by the framework, Webpack Encore. Webpack Encore is a simpler way to integrate Webpack into your application. It wraps Webpack, giving you a clean & powerful API for bundling JavaScript modules, pre-processing CSS & JS and compiling and minifying assets. Encore gives you professional asset system that's a delight to use.