Download the PHP package pg-momik/no-nepali-profanity without Composer

On this page you can find all versions of the php package pg-momik/no-nepali-profanity. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package no-nepali-profanity

no-nepali-profanity

A small, dependency-free profanity matcher for English, Romanized (Latin) Nepali and Devanagari Nepali, plus the Hindi slang common in Nepal. Built for moderating user-written text — names, comments, reviews — on Nepali sites, where false positives on real names are more damaging than a missed swear.

Zero runtime dependencies beyond PHP's own ext-intl (text normalization) and ext-mbstring (UTF-8 handling) — no third-party packages. PHP ≥ 8.2. A direct port of the no-nepali-profanity npm package, with the same word lists and matching rules.

Documentation: mukhxadnahunna.com/php

Install

Requires the intl and mbstring extensions.

Usage

API

Method Returns Notes
Profanity::containsProfanity($text, $options?) bool Yes/no from findProfanity.
Profanity::findProfanity($text, $options?) string[] Matching words normalised + lowercased (leet decoded, case-folded), deduplicated. Empty when clean.
Profanity::check($text, $options?) ProfanityCheck Scans once; inspect the result and censor it without scanning again.
Profanity::findProfanityMatches($text, $options?) ProfanityMatch[] Every occurrence with its position in the original text, sorted by position.
Profanity::censor($text, $options?) string The text with each match masked: "you muji" → "you ****". Options: mask (default "*"), replace(match).
Profanity::createFilter($options?) ProfanityFilter Builds the tables once for fixed options.
Profanity::tokenize($text) string[] Raw tokens the matcher sees. Useful for debugging why a word is (or isn't) caught.
Lexicon class Tagged entries (Lexicon::WORDS, Lexicon::STEMS, Lexicon::PHRASES), flat per-script lists (Lexicon::latinWords(), Lexicon::devanagariWords()…) and suffixes.

Match positions (ProfanityMatch::$start, $end) are code point (Unicode character) indices into the input, like the Python port — not UTF-16 code units like the npm package.

Censoring

Check and censor in one pass:

Options

Build the tables once and reuse them:

What it catches

What it deliberately doesn't

Development

The word lists live in src/Lexicon.php, apart from the matching logic in src/ProfanityFilter.php. Native-speaker review of the Nepali lists is the most valuable contribution.

License

MIT


All versions of no-nepali-profanity with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
ext-intl Version *
ext-mbstring Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pg-momik/no-nepali-profanity contains the following files

Loading the files please wait ...