Navigation Menu

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 / search.blade.php
Created September 10, 2018 14:00
View File for Laravel Search With Live Results: https://www.cloudways.com/blog/live-search-laravel-ajax/
<!DOCTYPE html>
<html>
<head>
<meta name="_token" content="{{ csrf_token() }}">
@azazqadir
azazqadir / ssl
Created September 14, 2018 14:23
Enable SSL on Laravel Website and Enable Force HTTPS Redirect: https://www.cloudways.com/blog/how-to-setup-https-ssl-certificates-on-laravel-5/
namespace MyApp\Http\Middleware;
use Closure;
class HttpsProtocol {
public function handle($request, Closure $next)
{
if (!$request->secure() && env('APP_ENV') === 'prod') {
return redirect()->secure($request->getRequestUri());
@azazqadir
azazqadir / readme.md
Created September 22, 2018 11:37
Step by Step Guide to Deploy Symfony Web to Server Using Envoyer

Step 1: Create an Envoyer Account and Add a Project Step 2: Connect Your GitHub Repository With Envoyer Account Step 3: Integrate Your Server With Envoyer Step 4: Click the Deploy button for actual project deployment.

Source: Deploy Symfony using Envoyer

@azazqadir
azazqadir / laravel.php
Created September 24, 2018 13:29
Laravel API Rate Limiting and Dynamic Rate Limiting: https://www.cloudways.com/blog/laravel-and-api-rate-limiting/
Route::group(['prefix' => 'api/v1'], function () {
Route::get('/getTasks', function () {
return Task::all();
});
Route::post('/addTask', function (Request $request) {
@azazqadir
azazqadir / index.php
Created September 25, 2018 07:31
Configuring Redis to be used as a PHP session Handler: (https://www.cloudways.com/blog/setup-redis-as-session-handler-php/ )
<?php
ini_set('session.save_handler', 'redis');
ini_set('session.save_path', "tcp://localhost:6379");
//echo ini_get('session.save_path');
session_start();
@azazqadir
azazqadir / readme.md
Last active September 26, 2018 07:44
Best PHP Frameworks of 2018
  • Laravel

  • Symfony

  • Codeigniter

  • Yii

  • Zend

@azazqadir
azazqadir / readme.md
Created September 29, 2018 13:06
PHP Performance Optimization Tips
  • Consider using the swoole extension. Some applications can run 30 times faster. Be sure you understand how it works.

  • Use cache wherever possible in order to reduce the amount of DB queries. Optimize the DB queries too, these are often the performance bottleneck of any web application regardless of the stacks / frameworks that are used.

  • varnish for full page caching & redis for session caching but it’s the best choice IMO.

Read Tons of More Tips on PHP Performance Optimization.

@azazqadir
azazqadir / readme.md
Created October 4, 2018 12:31
Building Ecommerce in Symfony

Symfony is great framework with some useful components. You can easily create Symfony ecommerce website using bundles. You can even create a rich UI by integrating React on front end. Learn more on how you can create a Symfony ecommerce website and integrate React and Cloudinary with it.

@azazqadir
azazqadir / readme.md
Created October 19, 2018 14:24
Creating Migration Table in Laravel for ToDo App

To create a simple ToDo application in Laravel, you first need to setup database. For that, start with configuring the .env file. Now to create table in Laravel, you need to create migration table. For that, use the following command

php artisan make:migration create_todo_table

Now execute migration with following command:

php artisan migrate
@azazqadir
azazqadir / readme.md
Created October 27, 2018 13:44
Parsing Data in JSON in Codeigniter

You can use Codeigniter curl library to parse data in JSON format. For this you can use POST request.

Add this to your JSON file

$this->load->library('Curl');

$url = 'http://your-domin.com/';

$formatJsondata = array(