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

Sped Common Laravel Package

nfephp-org/sped-common

Biblioteca PHP com classes utilitárias compartilhadas para os projetos SPED da nfephp-org: NFe, CTe, MDFe, e-Financeira, eSfinge e eSocial. Reúne componentes comuns para facilitar integrações e reutilização de código.

View on GitHub
Deep Wiki
Context7

NFePHP\Common\Strings::class

Auxiliar class for strings treatment

Methods

replaceSpecialsChars($string)

Replace all specials characters from string and retuns only 128 basic characters. [a-z] [A-Z] [0-9] @ space , - . ; : $ %

NOTE: only UTF-8

    $str = "Á é ç ";
    $ret = Strings::replaceSpecialsChars($str);
    echo $ret; //A e c

##replaceUnacceptableCharacters($string) Clear inputs for build in XML, convert all characters to UTF-8, Replace & isolated, less than, greater than, quotation marks and apostrophes in html entities Remove Carriage Return, Tab and Line Feed Remove Multiple spaces is not acceptable in strings Remove all other control character

NOTE: string may be mixed UTF-8 and Latin1 (iso 8859-1) or Windows-1252

    $string = "Contribuições R$   200,00   IPI:   15% Caixa D'agua Rico & Rich < > \"   \t \r \n ";
    $string .= mb_convert_encoding(" teste ç Á ã é ø", 'ISO-8859-1'); 
    $ret = Strings::replaceUnacceptableCharacters($string);
    echo $ret; //Contribuições R$ 200,00 IPI: 15% Caixa D'agua Rico & Rich < > " teste ç Á ã é ø

clearXml()

Remove some attributes, prefixes, sulfixes and other control characters like \r \n \s \t

    $ret = Strings::clearXml($xml);
    echo $ret; //clean xml will returned

clearProtocoledXML()

Clears the xml after adding the protocol, removing repeated namespaces.

    $protxml = Strings::clearProt($xmlstring);
    echo $protxml; //clean xml will returned

deleteAllBetween()

Remove all characters between markers.

    $str = '<?xml version="1.0" encoding="UTF-8"?><nfeProc versao="3.10" xmlns="http://www.portalfiscal.inf.br/nfe">
    <NFe xmlns="http://www.portalfiscal.inf.br/nfe">';
    
    $ret = Strings::deleteAllBetween($str, '<?xml', '?>');
    echo $ret; //returns xml without encoding tag

randomString()

Creates a string ramdomically with the specified length.

    $randomStr = Strings::randomString(5);
    echo $randomStr; //zRT20

removeSomeAlienCharsfromTxt()

  • Removes [CR] and [TAB]

  • Removes duplicated [spaces]

  • Removes [spaces] after | (pipe)

  • Removes [spaces] before | (pipe)

  • @param string $txt

  • @return string

    $txtclean = Strings::removeSomeAlienCharsfromTxt($txt);
    echo $txtclean; //returns txt without this characters  
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor