Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

String Encoder Laravel Package

devanoxltd/string-encoder

View on GitHub
Deep Wiki
Context7

Regex

Contracts

Each part of this package which is intended for public usage has an associated contract interface which will not be changed without a major version update. The contract interfaces are used for dependency which will allow you to insert your own behavior into the package. We will be covering the following contract interfaces in this document.

MB

Basics

The functionality covered by this contract supports regex for MB strings. It leverages the encoding functionality and validation from the encoder to ensure a safer execution of the regex.

<?php

use StringEncoder\MB\Regex;
use StringEncoder\Encoder;

$str     = "Calendrier de l'avent façon Necta!";
$encoder = new Encoder();
$MBStringDTO = $encoder->convert()->fromString($str)->toDTO();

$regex = new Regex();
$ResultMBStringDTO = $regex->replace('[^A-Za-z0-9\.\-]', '', $MBStringDTO);
echo $ResultMBStringDTO->getString(); // "Calendrierdelaventfaonnecta" in UTF-8 encoding.

Setting encoding

You can set the encoding to be used by the regex functionality. The encoding that is passed is validated to ensure that it can be used by the system and will throw a InvalidEncodingException error if it is not supported.

<?php

use StringEncoder\MB\Regex;
use StringEncoder\Encoder;

$str     = "Calendrier de l'avent façon Necta!";
$encoder = new Encoder();
$encoder->setTargetEncoding('ASCII');
$MBStringDTO = $encoder->convert()->fromString($str)->toDTO();

$regex = new Regex();
$regex->setEncoding('ASCII');
$ResultMBStringDTO = $regex->replace('[^A-Za-z0-9\.\-]', '', $MBStringDTO);
echo $ResultMBStringDTO->getString(); // "Calendrierdelaventfaonnecta" in ASCII encoding.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed