2017 © Pedro Peláez
 

library laravel-word-template

Package Laravel untuk melakukan penggantian kata pada file menggunakan template dokumen (.rtf) yang sudah disediakan.

image

novay/laravel-word-template

Package Laravel untuk melakukan penggantian kata pada file menggunakan template dokumen (.rtf) yang sudah disediakan.

  • Wednesday, May 23, 2018
  • by novay
  • Repository
  • 1 Watchers
  • 2 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 29 % Grown

The README.md

Laravel Word Template

Latest Stable Version Total Downloads License: MIT, (*1)

About

Laravel Package to perform word replacement on files using document templates (.rtf) that have been provided., (*2)

[ID] Package Laravel untuk melakukan penggantian kata pada file menggunakan template dokumen (.rtf) yang sudah disediakan., (*3)

Example, (*4)

Requirements

Installation Instructions

  1. From your projects root folder in terminal run:, (*5)

        composer require novay/laravel-word-template
    
  2. Register the package, (*6)

    • Laravel 5.5 and up Uses package auto discovery feature, no need to edit the config/app.php file., (*7)

    • Laravel 5.4 and below Register the package with laravel in config/app.php under providers and aliases with the following:, (*8)

        'providers' => [
        ...
            Novay\WordTemplate\WordTemplateServiceProvider::class,
        ];
    
        'aliases' => [
        ...
           'WordTemplate' => Novay\WordTemplate\Facade::class, 
        ];
    

Panduan Penggunaan [ID]

  1. Siapkan template yang ingin Anda gunakan, pastikan template berupa file dokumen. Sebagai contoh anda bisa menggunakan contoh ini. Jika tidak langsung terunduh secara otomatis, kamu bisa tekan Ctrl+S untuk menyimpan secara manual dengan format .rtf. Setelah terdownload cukup letakkan file tersebut di folder public atau dimanapun anda mau., (*9)

  2. Silahkan bermain-main dengan facade ini:, (*10)

    WordTemplate::export('file.rtf', array(), 'nama_file.doc');

Method ini membutuhkan 3 parameter didalam penggunaannya:, (*11)

  • Lokasi file dokumen yang menjadi template Anda Contoh: public_path('template/document.rtf')
  • Kumpulan kata-kata awal beserta kata penggantinya dalam bentuk array. Lihat contoh
  • Tentukan nama file yang diinginkan ketika file diunduh. Contoh. file.doc
  1. Contoh Agar cepat, salin baris berikut ke dalam file routes.php Anda :
    Route::get('/', function () {
        $file = public_path('surat_pernyataan.rtf');

        $array = array(
            '[NOMOR_SURAT]' => '015/BT/SK/V/2017',
            '[PERUSAHAAN]' => 'CV. Borneo Teknomedia',
            '[NAMA]' => 'Melani Malik',
            '[NIP]' => '6472065508XXXX',
            '[ALAMAT]' => 'Jl. Manunggal Gg. 8 Loa Bakung, Samarinda',
            '[PERMOHONAN]' => 'Permohonan pengurusan pembuatan NPWP',
            '[KOTA]' => 'Samarinda',
            '[DIRECTOR]' => 'Noviyanto Rahmadi',
            '[TANGGAL]' => date('d F Y'),
        );

        $nama_file = 'surat-keterangan-kerja.doc';

        return WordTemplate::export($file, $array, $nama_file);
    });

Basic Usage [EN]

  1. You need to prepare the template document that you want, for example you can download this file. If it is not downloading automatically, you can just press Ctrl+S to save it manually as .rtf file., (*12)

  2. You can use this facade to play with this :, (*13)

    WordTemplate('file.rtf', array(), 'nama_file.doc');

This method needs you to specify 3 parameters in it:, (*14)

  • Location of your document template file Ex. public_path('template/document.rtf')
  • The initial words along with their replacement in the arrays form. See example
  • Specifies the file name when the file is downloaded Ex. file.doc
  1. Example Copy this file in your routes directly for the instance :
    Route::get('/', function () {
        $file = public_path('surat_pernyataan.rtf');

        $array = array(
            '[NOMOR_SURAT]' => '015/BT/SK/V/2017',
            '[PERUSAHAAN]' => 'CV. Borneo Teknomedia',
            '[NAMA]' => 'Melani Malik',
            '[NIP]' => '6472065508XXXX',
            '[ALAMAT]' => 'Jl. Manunggal Gg. 8 Loa Bakung, Samarinda',
            '[PERMOHONAN]' => 'Permohonan pengurusan pembuatan NPWP',
            '[KOTA]' => 'Samarinda',
            '[DIRECTOR]' => 'Noviyanto Rahmadi',
            '[TANGGAL]' => date('d F Y'),
        );

        $nama_file = 'surat-keterangan-kerja.doc';

        return WordTemplate::export($file, $array, $nama_file);
    });

License

Laravel Word Template is licensed under the MIT license. Enjoy!, (*15)

The Versions

23/05 2018

dev-master

9999999-dev

Package Laravel untuk melakukan penggantian kata pada file menggunakan template dokumen (.rtf) yang sudah disediakan.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Noviyanto Rahmadi

laravel export word rtf

23/05 2018

v1.1

1.1.0.0

Package Laravel untuk melakukan penggantian kata pada file menggunakan template dokumen (.rtf) yang sudah disediakan.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Noviyanto Rahmadi

laravel export word rtf

13/02 2018

v1.0

1.0.0.0

Package Laravel untuk melakukan penggantian kata pada file menggunakan template dokumen (.rtf) yang sudah disediakan.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Noviyanto Rahmadi

laravel export word rtf