PHPackages                             orglman/fundamental - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. orglman/fundamental

ActiveLibrary

orglman/fundamental
===================

A reposotory of fundamental features that are used in Orgelman's project.

0.0.5(5y ago)28MITPHP

Since Dec 17Pushed 4y ago2 watchersCompare

[ Source](https://github.com/orglman/fundamental)[ Packagist](https://packagist.org/packages/orglman/fundamental)[ RSS](/packages/orglman-fundamental/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (5)Used By (0)

Orgelman Fundamental Scripts (OFS)
==================================

[](#orgelman-fundamental-scripts-ofs)

[![Build Status](https://camo.githubusercontent.com/363ed7f16135791f495abf717b2c54c04a957d4802953a29234533d5837b88bc/68747470733a2f2f7472617669732d63692e6f72672f6f72676c6d616e2f66756e64616d656e74616c2e737667)](https://travis-ci.org/orglman/fundamental)[![composer.lock available](https://camo.githubusercontent.com/1d920d038805c6d15e48a9fbf5f3a83677fe5d3cbcab53d6d153934c0d5a366e/68747470733a2f2f706f7365722e707567782e6f72672f6f72676c6d616e2f66756e64616d656e74616c2f636f6d706f7365726c6f636b)](https://packagist.org/packages/orglman/fundamental)

[![Latest Stable Version](https://camo.githubusercontent.com/fc172a43634f85a55bbb40ceb1740b1ff717f183aa2e76c3cae02fb585c0d391/68747470733a2f2f706f7365722e707567782e6f72672f6f72676c6d616e2f66756e64616d656e74616c2f762f737461626c652e737667)](https://packagist.org/packages/orglman/fundamental)[![Latest Unstable Version](https://camo.githubusercontent.com/d658a2838ae3b6bbeb539b809267a1a0080a1c0c27e9952586e66705d2d4bcd8/68747470733a2f2f706f7365722e707567782e6f72672f6f72676c6d616e2f66756e64616d656e74616c2f762f756e737461626c652e737667)](https://packagist.org/packages/orglman/fundamental)[![Latest Stable Version](https://camo.githubusercontent.com/9e00a6b165e8b17e4b7588662dde572019da1ad4c778423beecf5a4ce24dc87e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f6f72676c6d616e2f66756e64616d656e74616c2e737667)](https://packagist.org/packages/orglman/fundamental)

[![star this repo](https://camo.githubusercontent.com/a1f3400cd10ff8ee29ae8daf06d4f7bda5469fcfabd70ad7a476616f78754ad2/687474703a2f2f6769746875626261646765732e636f6d2f737461722e7376673f757365723d6f72676c6d616e267265706f3d66756e64616d656e74616c267374796c653d666c6174)](https://github.com/orglman/fundamental)[![fork this repo](https://camo.githubusercontent.com/f312258f0cf4d4e6819b1d6f5239399df86d405dccfb60cc04b51daf8cb187fc/687474703a2f2f6769746875626261646765732e636f6d2f666f726b2e7376673f757365723d6f72676c6d616e267265706f3d66756e64616d656e74616c267374796c653d666c6174)](https://github.com/orglman/fundamental/fork)[![Pending Pull-Requests](https://camo.githubusercontent.com/365ff05043bc2968e9177792fd63e200be92da7fb1d67999d1b8f177b80a91a6/687474703a2f2f6769746875626261646765732e6865726f6b756170702e636f6d2f6f72676c6d616e2f66756e64616d656e74616c2f70756c6c732e7376673f7374796c653d666c6174)](https://github.com/orglman/fundamental/pulls)[![Open Issues](https://camo.githubusercontent.com/25fda3724c40ecea676414595651458ca690f337a48dd869f6f3fdffc340a326/687474703a2f2f6769746875626261646765732e6865726f6b756170702e636f6d2f6f72676c6d616e2f66756e64616d656e74616c2f6973737565732e7376673f7374796c653d666c6174)](https://github.com/orglman/fundamental/issues)

[![Total Downloads](https://camo.githubusercontent.com/26f7629ef18d1696237dc8dab2d88b067ea256b41a52fa8ba6d5c4b50573dbde/68747470733a2f2f706f7365722e707567782e6f72672f6f72676c6d616e2f66756e64616d656e74616c2f646f776e6c6f616473)](https://packagist.org/packages/orglman/fundamental)

[![License](https://camo.githubusercontent.com/508e8e40b2bbe8dcf3f1dcefdadfd7189d31583c96cfa8f31b44df728454219b/68747470733a2f2f706f7365722e707567782e6f72672f6f72676c6d616e2f66756e64616d656e74616c2f6c6963656e73652e737667)](https://packagist.org/packages/orglman/fundamental)

A reposotory of fundamental features that are used in Orgelman's project.

Disclaimer
----------

[](#disclaimer)

In the words of Abraham Lincoln:

> Pardon my French

My English and technical language in the code is **NOT** on point... Sorry for any confusion.

Install
-------

[](#install)

OFS is available on [Packagist](https://packagist.org/packages/orglman/fundamental) (using semantic versioning), and installation via Composer is the recommended way to install OFS. Just add this line to your composer.json file:

```
"orglman/fundamental": "@dev"

```

or run

```
composer require orglman/fundamental

```

Note that the vendor folder and the vendor/autoload.php script are generated by Composer; they are not part of OFS.

Code Examples
-------------

[](#code-examples)

### Forbid direct access

[](#forbid-direct-access)

```
if((isset($_SERVER["SCRIPT_FILENAME"]))&&(basename(__FILE__)==basename($_SERVER["SCRIPT_FILENAME"]))){header($_SERVER['SERVER_PROTOCOL'].' 401 Unauthorized',true,401);header('Status: '.'401 Unauthorized');header('Retry-After: 86400');die('401 Unauthorized');}
if(get_included_files()[0]==__FILE__){header($_SERVER['SERVER_PROTOCOL'].' 401 Unauthorized', true, 401);header('Status: '.'401 Unauthorized');header('Retry-After: 86400');die('401 Unauthorized');}
```

### Getting script elapsed time

[](#getting-script-elapsed-time)

```
$functions        = new \orgelman\fundamental\scripts\functions($root = null, $start = microtime(true));
echo $functions->timeElapsed();
```

### Hide emails

[](#hide-emails)

```
$functions        = new \orgelman\fundamental\scripts\functions();
echo $functions->obfuscate_email('test@example.com');
echo $functions->botTrap('test@example.com');
```

### Get user agent, IP and client info

[](#get-user-agent-ip-and-client-info)

```
$functions        = new \orgelman\fundamental\scripts\functions();
print_r($functions->get_client());
echo $functions->get_client_ua();
echo $functions->get_client_ip();
```

### Encrypting and decrypting strings

[](#encrypting-and-decrypting-strings)

```
$str              = 'message';
$encrypt          = new orgelman\fundamental\security\encrypt($compress = 'true','sha256');
$encrypted        = $encrypt->encrypt($str, $key, $method = '')['encrypted'];

$decrypted        = $encrypt->decrypt($encrypted, $key, $method = '')['decrypted'];
```

### Test passwords

[](#test-passwords)

```
$hash             = new orgelman\fundamental\security\hash($compress = 'true');
$password         = 'password';

$hash->setPasswordLenghtMin($num);
$hash->setPasswordLenghtMax($num);
$hash->setPasswordNumber($num);
$hash->setPasswordLetter($num);
$hash->setPasswordCapital($num);
$hash->setPasswordSymbol($num);

$test = $hash->test($password);
if($test!=true) {
   echo '';
   foreach(test as $error) {
      echo ''.$error.'';
   }
   echo '';
}
```

### Hashing and validating passwords

[](#hashing-and-validating-passwords)

```
$password         = 'password';
$hash             = new orgelman\fundamental\security\hash($compress = 'true');
$hash->setPasswordLenghtMin($num); // Password minimum lenght
$hash->setPasswordLenghtMax($num); // Password maximum lenght
$hash->setPasswordNumber($num); // How many numbers the password must contain
$hash->setPasswordLetter($num); // How many letters the password must contain
$hash->setPasswordCapital($num); // How many CAPS the password must contain
$hash->setPasswordSymbol($num); // How many symbols the password must contain
$hash->setPasswordStrength($num); // How strong the password must be (0-4)

$hashedPass       = $hash->generate($password);
if(!is_string($hashedPass)) {
   echo '';
   foreach(hashedPass as $error) {
      echo ''.$error.'';
   }
   echo '';
} else {
  if($hash->valid(password, $hashedPass)) {
    echo 'Yay!';
  } else {
    echo 'Nay!';
  }
}
```

Tests
-----

[](#tests)

There is a PHPUnit test script in the [test](https://github.com/orglman/fundamental/tree/master/test/) folder.

Build status: [![Build Status](https://camo.githubusercontent.com/363ed7f16135791f495abf717b2c54c04a957d4802953a29234533d5837b88bc/68747470733a2f2f7472617669732d63692e6f72672f6f72676c6d616e2f66756e64616d656e74616c2e737667)](https://travis-ci.org/orglman/fundamental)

If this isn't passing, is there something you can do to help?

Authors
-------

[](#authors)

- **Tobias Jonson** - *Developer* - [orglman](https://github.com/orglman)

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~251 days

Total

4

Last Release

1946d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ac8adebde8a56a0aae667a33481013d1a01d67ac4a9cef7ad95d4e6960c64385?d=identicon)[orglman](/maintainers/orglman)

---

Top Contributors

[![orglman](https://avatars.githubusercontent.com/u/39733563?v=4)](https://github.com/orglman "orglman (179 commits)")

### Embed Badge

![Health badge](/badges/orglman-fundamental/health.svg)

```
[![Health](https://phpackages.com/badges/orglman-fundamental/health.svg)](https://phpackages.com/packages/orglman-fundamental)
```

###  Alternatives

[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[silverstripe/framework

The SilverStripe framework

7213.5M2.5k](/packages/silverstripe-framework)[10up/10up-experience

The 10up Experience plugin configures WordPress to better protect and inform clients, aligned to 10up's best practices

139477.6k](/packages/10up-10up-experience)[thecodingmachine/tdbm

The Database Machine is a PHP ORM that requires no configuration. The object model is deduced from the database model.

123174.9k6](/packages/thecodingmachine-tdbm)[olssonm/l5-zxcvbn

Implementation of the zxcvbn project by @dropbox for Laravel. Uses zxcvbn-php by @bjeavons.

28311.1k1](/packages/olssonm-l5-zxcvbn)[rexshijaku/sql-to-laravel-builder

SQL to Laravel Query Builder

18925.9k1](/packages/rexshijaku-sql-to-laravel-builder)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
