Laravel 5.2 : UTF-8 issue while exporting CSV

To show UTF-8 (Unicode) in csv exporting in laravel 5.2
add or enable
‘use_bom’ => true  at Excel.php

 

 

Advertisements

How to Setup Virtual Host with XAMPP and LARAVEL at window OS

Step 1 – Add one virtual host at “httpd-vhosts.conf” at C:/xampp/apache/conf/extra/httpd-vhosts.conf

<VirtualHost *:8085>

DocumentRoot “D:/my_work_project_path/Project_Name/public”

ServerAdmin Project_Name@localhost

ServerName Project_Name

ServerAlias Project_Name

 

<Directory ” D:/my_work_project_path/Project_Name/public “>

AllowOverride All

Order Allow,Deny

Allow from all

Require all granted

</Directory>

</VirtualHost>

 

 

 

Step 2 – Add one host to C:/Windows/System32/drivers/etc/hosts

127.0.0.1             Project_Name

Step 3 – Add one Listen Port to “httpd.conf” at C:\xampp\apache\conf\httpd.conf

Listen 8085

 

Step 4 – Restart Apache server and browse from browser with “http://localhost:8085/”
 

Myanmar Font in TC/PDF export in PHP with laravel

You need to download the font ttf file
Zawgyi-One-20051130.ttf

================
Utility.php
=================
<?php namespace App\Core;

use Validator;
use Auth;
use DB;
use App\Http\Requests;
use App\Session;
use PDF;
use TCPDF_FONTS;

class Utility
{
// Use Pdf Export
public static function exportPDF($html,$pdfTitle = 'exportPDF')
{
PDF::SetTitle($pdfTitle);

require_once(base_path() . '/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php');
// $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$fontname = TCPDF_FONTS::addTTFfont(app_path() .'/Core/Export/Zawgyi-One-20051130.ttf', 'TrueTypeUnicode', '', 32);

// $font1 = PDF::addTTFfont('/home/waiyan/Downloads/Zawgyi-One-20051130.ttf', 'TrueTypeUnicode', '', 8);
PDF::SetFont($fontname, '', 15, '', false);

// set font
//PDF::SetFont('helvetica', '', 12);
PDF::AddPage();
PDF::writeHTML($html, true, false, false, false, '');

PDF::Output($pdfTitle . '.pdf');
exit();

}

}
===========================================
ServicePdfGenerator.php
===========================================
<?php

namespace App\Core\Export;

use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Input;
use App\Core\Config\Config;
use App\Core\Utility;
use PDF;

class ServicePdfGenerator implements IPDFGeneratorInterface
{
public function generate($paramObj)
{

ob_end_clean();
ob_start();

$html = <<<EOD

.table_main {
font-size: 10;
}

.table_border {
border: 1;
}

ကခဂ ကခဂ ကခဂ ကခဂ

EOD;

Utility::exportPDF($html,”mm_font_pdf”);
return true;

}
}
==============================================

How to install Mail Service at Ubutu Live Serer (LEMP)

How to install Mail Service at Ubutu Live Serer (LEMP)

Install mailutils by the following command
apt-get install mailutils
apt-get install ssmtp

edit ssmtp.conf under /etc/ssmtp/ssmtp.conf
Remove “#” from “#FromLineOverride=YES” and add the following lines to ssmtp.conf

FromLineOverride=YES
AuthUser=youremail@gmail.com
AuthPass=yourpassword
mailhub=smtp.gmail.com:587
UseSTARTTLS=YES

After that, test email can send it or not with the following command
echo “tesitng” | mail -s “testing” william.aceplus@gmail.com

============================
Checking Error about mail
/var/log/mail.err
============================

if some setting are not and you want to re-configure the setting

Reconfigure / Resetting setting
sudo dpkg-reconfigure postfix
sudo dpkg-reconfigure mailutils
============================

 

Cheers

dompdf/dompdf v0.7.0 requires ext-gd * -> the requested PHP extension gd is missing from your system

Problem 1
    - dompdf/dompdf v0.7.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - barryvdh/laravel-dompdf v0.7.0 requires dompdf/dompdf ^0.7 -> satisfiable by dompdf/dompdf[v0.7.0].
    - Installation request for barryvdh/laravel-dompdf ^0.7.0 -> satisfiable by barryvdh/laravel-dompdf[v0.7.0].


Solution

If you are working in PHP version 5.* then you have to install

sudo apt-get install php5-gd
And if you are working in PHP version 7.* then you have to install

sudo apt-get install php7.0-gd

Hope it will work..

Cheers

The hosted network couldn’t be started at windows OS

When I try to run netsh wlan start hostednetwork, I get the following message:

C:\Windows\system32>netsh wlan start hostednetwork
The hosted network couldn’t be started.
The group or resource is not in the correct state to perform the requested operation.

Solution
Go to device manager by “devmgmt.msc” at run box
then open the network adapters tree ,
right click button on Microsoft Hosted Network Virtual Adapter and click on enable

Try now with the command netsh wlan start hostednetwork with admin privileges. It should work.

Cheers

============================================================