Giter VIP home page Giter VIP logo

censorit's Introduction

Hallo selamat datang di Censorit

Censorit merupakan sebuah package PHP yang memiliki fungsi untuk memberikan efek sensor terhadap suatu kata. Censorit sebagian besar menggunakan regex untuk menentukan posisi karakter mana yang akan disensor.

Cara instalasi

Pastikan sudah memiliki composer di mesin kalian. Jika belum, silakan install composer terlebih dahulu.

Untuk menginstall Censorit, jalankan perintah di bawah

composer require khumam/censorit

Jika sudah selesai, artinya Censorit siap digunakan.

Cara penggunaan

Cara penggunaannya sangat mudah. Contohnya dapat dilihat di bawah ini.

<?php

// Pastikan load vendor terlebih dahulu
require './vendor/autoload.php';

// Kemudian load package nya
use khumam\censorit\Censorit;

// Misalkan kita memiliki suatu kata yang akan disensor
$string = 'ABCDEF GHIJK';

// Dan cara sensornya
$censoredString = Censorit::censor($string)->full() // Hasil ***********
$censoredString = Censorit::censor($string)->half() // Hasil ABCDEF GHI**
$censoredString = Censorit::censor($string)->middle() // Hasil AB**** ***JK

Kumpulan method

Ada beberapa method yang bisa digunakan di dalam Censorit.

Method Parameter Deskripsi Example
full With space (default: true) Untuk mensensor seluruh teks. Jika memasukan parameter false, maka spasi tidak akan ikut tersensor full() atau full(false)
half offset (default: 2) Untuk mensensor sebagian teks. Jika offset diisi positif, akan mensensor huruf sebanyak offset dari belakang. Jika negatif, dari depan half(2) atau half(-2)
middle offset (default: 2), reverse (default: false) Untuk mensensor karakter yang berada di tengah teks sebanyak offset. Jika reverse true, yang disensor yang disamping kiri kanan nya middle(2) atau middle(2, true)

Jika offset lebih besar dari kata, maka hasilnya akan disensor seluruh kata.

To do list

  • Sensor full teks
  • Sensor full teks selain spasi
  • Sensor di awal teks sebanyak offset
  • Sensor di akhir teks sebanyak offset
  • Sensor di tengah teks sebanyak offset
  • Sensor kecuali di tengah teks sebanyak offset
  • Sensor di posisi random

Kontribusi

Saya sangat mengharapkan teman-teman untuk berkontribusi di repo ini. Detail kontribusi akan dijelaskan di lain waktu.

censorit's People

Contributors

khumam avatar

Watchers

 avatar

Forkers

andidevrian

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.