1. Go to this page and download the library: Download samsonasik/naming library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
samsonasik / naming example snippets
use Naming\Filter;
use Naming\Validator;
use Laminas\Form\Element\Text;
use Laminas\Form\Form;
use Laminas\InputFilter\InputFilterProviderInterface;
class ContactForm extends Form implements InputFilterProviderInterface
{
public function init()
{
$this->add([
'type' => Text::class,
'name' => 'fullname',
'options' => [
'label' => 'Full name',
],
]);
}
public function getInputFilterSpecification()
{
return [
[
'name' => 'fullname',
'
use Naming\Filter;
use Naming\Validator;
ing())->filter('Abdul malik ikhsan');
$validator = new Validator\Naming();
echo $filtered; // Abdul Malik Ikhsan
var_dump($validator->isValid($filtered)); // true
// ... INVALID
$filtered = (new Filter\Naming())->filter('Abdul....');
$validator = new Validator\Naming();
echo $filtered; // Abdul....
var_dump($validator->isValid($filtered)); // false
var_dump(\current($validator->getMessages())); /* "Consecutive "."s are not allowed" */
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.