2017 © Pedro Peláez
 

library laravel-profane

Laravel 5.X Profanity Valitador

image

arandilopez/laravel-profane

Laravel 5.X Profanity Valitador

  • Thursday, May 3, 2018
  • by arandilopez
  • Repository
  • 2 Watchers
  • 62 Stars
  • 2,018 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 22 Forks
  • 6 Open issues
  • 15 Versions
  • 37 % Grown

The README.md

Laravel Profanity Validator

Latest Stable Version Total Downloads License Daily Downloads composer.lock StyleCI, (*1)

I made this package to perform a validation for swearwords using Laravel validation service., (*2)

Installation

Install via composer, (*3)

composer require arandilopez/laravel-profane

Configuration

Add the ProfaneServiceProvider class in your config/app.php file., (*4)

<?php
return [
    // ...

    'providers' => [
        // ...
        LaravelProfane\ProfaneServiceProvider::class,
    ];

    // ...
];

Publish vendor lang files if you need to replace by your own., (*5)

php artisan vendor:publish

Usage

This package register a custom validator. You can use in your controller's validate function., (*6)

<?php
// ...
class MyController extends Controller
{
    public function store(Request $request)
    {
        $this->validate($request, [
            'username' => 'required|profane'
        ]);

        // ...
    }
}

The validator will load the default locale in your config/app.php file configuration which by is en. If your locale is not supported, please post an issue for this project, (*7)

If you want to use others dictionaries you can pass them as parameters in the validator., (*8)

<?php
// ...
class MyController extends Controller
{
    public function store(Request $request)
    {
        $this->validate($request, [
            'username' => 'required|profane:es,en'
        ]);

        // ...
    }
}

You can also send as parameter a path of a file which is a dictionary in order to replace the default dictionary or add a new non supported locale., (*9)

<?php
// ...
class MyController extends Controller
{
    public function store(Request $request)
    {
        $this->validate($request, [
            'username' => 'required|profane:es,en,'.resource_path('lang/fr/dict.php')
        ]);

        // ...
    }
}

Strict validation

Now you can strictly validate the exact profane word in the content., (*10)

<?php
// ...
class MyController extends Controller
{
    public function store(Request $request)
    {
        $this->validate($request, [
            'username' => 'required|strictly_profane:es,en'
        ]);

        // ...
    }
}

This fixes known issues when you get a error in validation for words like class or analysis, as they include ass and anal respectively, but fails the validation for content like sucker69., (*11)

Getting Help

If you're stuck getting something to work, or need to report a bug, please post an issue in the Github Issues for this project., (*12)

Contributing

If you're interesting in contributing code to this project, clone it by running:, (*13)

git clone git@github.com:arandilopez/laravel-profane.git

Please read the CONTRIBUTING file., (*14)

Pull requests are welcome, but please make sure you provide unit tests to cover your changes. You can help to add and support more locales!, (*15)

Thanks to @dorianneto for his contributions., (*16)

Supported Locales

License

This project is open-sourced software licensed under the MIT license., (*17)

The Versions

03/05 2018

dev-master

9999999-dev

Laravel 5.X Profanity Valitador

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arandi Lopez

11/10 2017

v0.3.5

0.3.5.0

Laravel 5.X Profanity Valitador

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arandi Lopez

11/10 2017

dev-analysis-8KJop3

dev-analysis-8KJop3

Laravel 5.X Profanity Valitador

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arandi Lopez

11/10 2017

dev-analysis-zEYPov

dev-analysis-zEYPov

Laravel 5.X Profanity Valitador

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arandi Lopez

11/10 2017

v0.3.4

0.3.4.0

Laravel 5.X Profanity Valitador

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arandi Lopez

28/09 2017

v0.3.3

0.3.3.0

Laravel 5.X Profanity Valitador

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arandi Lopez

28/09 2017

v0.3.2

0.3.2.0

Laravel 5.X Profanity Valitador

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arandi Lopez

21/06 2017

v0.3.1

0.3.1.0

Laravel 5.X Profanity Valitador

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arandi Lopez

20/06 2017

v0.3.0

0.3.0.0

Laravel 5.X Profanity Valitador

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arandi Lopez

05/06 2017

v0.2.3

0.2.3.0

Laravel 5.X Profanity Valitador

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arandi Lopez

08/05 2017

v0.2.2

0.2.2.0

Laravel 5.X Profanity Valitador

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arandi Lopez

21/02 2017

v0.2.1

0.2.1.0

Laravel 5.X Profanity Valitador

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arandi Lopez

19/07 2016

v0.2.0

0.2.0.0

Laravel 5.X Profanity Valitador

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arandi Lopez

19/07 2016

v0.1.1

0.1.1.0

Laravel 5.X Profanity Valitador

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arandi Lopez

19/07 2016

v0.1.0

0.1.0.0

Laravel 5.X Profanity Valitador

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arandi Lopez