🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis
Socket
Book a DemoInstallSign in
Socket

oro-php-locutus

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oro-php-locutus

Fork of few Locutus functions that have been rewritten in TypeScript.

latest
Source
npmnpm
Version
2.1.7
Version published
Weekly downloads
184
54.62%
Maintainers
1
Weekly downloads
 
Created
Source

Oro Php Locutus

  • Overview
  • Installation
  • Methods

Overview

Locutus is a project that seeks to assimilate other languages’ standard libraries to JavaScript.

Locutus is a huge library created by a community effort, so instead of downloading all their code, this is just a piece of it.

This package is a fork of few Locutus functions that have been rewritten in TypeScript.

These functions have no dependencies and are browser friendly.

Installation

npm install oro-php-locutus

Methods

serialize()

serialize( mixedValue: any ): string

Here's what Locutus JavaScript equivalent to PHP's serialize looks like.

// cjs
const { serialize } = require( 'oro-php-locutus' );
// mjs, ts
import { serialize } from 'oro-php-locutus';

serialize( { chacho: true, tio: 17 } );
// 'a:2:{s:6:"chacho";b:1;s:3:"tio";i:17;}'

serialize( [ 'chacho', '', true, false, 1, 2.3 ] );
// 'a:6:{i:0;s:6:"chacho";i:1;s:0:"";i:2;b:1;i:3;b:0;i:4;i:1;i:5;d:2.3;}'

unserialize()

unserialize( str: string ): string

Here's what Locutus JavaScript equivalent to PHP's unserialize looks like.

// cjs
const { unserialize } = require( 'oro-php-locutus' );
// mjs, ts
import { unserialize } from 'oro-php-locutus';

unserialize( 'a:2:{s:6:"chacho";b:1;s:3:"tio";i:17;}' );
// { chacho: true, tio: 17 }

unserialize( 'a:6:{i:0;s:6:"chacho";i:1;s:0:"";i:2;b:1;i:3;b:0;i:4;i:1;i:5;d:2.3;}' );
// [ 'chacho', '', true, false, 1, 2.3 ]

htmlspecialchars()

htmlspecialchars(
  string: string,
  quoteStyle?: ENT_OPTION | ENT_OPTION[],
  charset?: null,
  doubleEncode?: boolean
): string

type ENT_OPTION =
  | 0 | 'ENT_NOQUOTES'
  | 1 | 'ENT_HTML_QUOTE_SINGLE'
  | 2 | 'ENT_HTML_QUOTE_DOUBLE'
      | 'ENT_COMPAT'
  | 3 | 'ENT_QUOTES'
  | 4 | 'ENT_IGNORE'

Here's what Locutus JavaScript equivalent to PHP's unserialize looks like.

// js
const { htmlspecialchars } = require( 'oro-php-locutus' );
// ts
import { htmlspecialchars } from 'oro-php-locutus';

htmlspecialchars( '<a href="test">Test</a>', 'ENT_QUOTES' );
// '&amp;lt;a href=&amp;quot;test&amp;quot;&amp;gt;Test&amp;lt;/a&amp;gt;'

utf8Encode()

utf8Encode( str: string ): string

Here's what Locutus JavaScript equivalent to PHP's unserialize looks like.

// cjs
const { utf8Encode } = require( 'oro-php-locutus' );
// mjs, ts
import { utf8Encode } from 'oro-php-locutus';

utf8Encode( 'Chacho' );
// 'Chacho'

utf8Encode( 'cañón' );
// 'cañón'

utf8Decode()

utf8Decode( str: string ): string

Here's what Locutus JavaScript equivalent to PHP's unserialize looks like.

// cjs
const { utf8Decode } = require( 'oro-php-locutus' );
// mjs, ts
import { utf8Decode } from 'oro-php-locutus';

utf8Decode( 'Chacho' );
// 'Chacho'

utf8Decode( 'cañón' );
// 'cañón'

md5()

md5( str: string ): string

Here's what Locutus JavaScript equivalent to PHP's unserialize looks like.

// cjs
const { md5 } = require( 'oro-php-locutus' );
// mjs, ts
import { md5 } from 'oro-php-locutus';

md5( 'chacho' );
// '496c84fb22e82d68fad9e5fe8e89d03d'

Keywords

php-locutus

FAQs

Package last updated on 21 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts