PHPackages                             basteyy/various-php-snippets - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. basteyy/various-php-snippets

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

basteyy/various-php-snippets
============================

A small set of function I needed often in small projects. And a simple translation function.

0.1.2(2y ago)0651MITPHPPHP ^8.2|^8.1|^8.0

Since Oct 17Pushed 2y ago1 watchersCompare

[ Source](https://github.com/basteyy/various-php-snippets)[ Packagist](https://packagist.org/packages/basteyy/various-php-snippets)[ Docs](https://github.com/basteyy/various-php-snippets)[ RSS](/packages/basteyy-various-php-snippets/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (5)Used By (1)

> Disclaimer 2023: This package is not maintained anymore. The parts of the package are now own packages. Please use them instead.

various-php-snippets
====================

[](#various-php-snippets)

Just a collection of various php snippets I used from time to time.

Install the package
-------------------

[](#install-the-package)

> Deprecated: Please use the new packages instead:
>
> - [basteyy/php-stringer](https://github.com/basteyy/php-stringer)
> - [basteyy/php-i18n](https://github.com/basteyy/php-i18n)
> - [basteyy/var-debug](https://github.com/basteyy/var-debug)

Please use composer to install the package:

```
composer require basteyy/various-php-snippets
```

Snippets Overview
-----------------

[](#snippets-overview)

### `getDateTimeFormat`

[](#getdatetimeformat)

The function `getDateTimeFormat` create a valid [MySQL-Datetime-Formatted](https://dev.mysql.com/doc/refman/8.0/en/datetime.html) datetime.

By default the function will create the current datetime. You can pass a [DateTime](https://www.php.net/manual/en/class.datetime) Instance to change the output.

#### Usage

[](#usage)

```
echo \basteyy\VariousPhpSnippets\getDateTimeFormat();
// Result: current date time in format: yyy-dd-mm hh:mm:ii

echo \basteyy\VariousPhpSnippets\getDateTimeFormat((new DateTime('2020-01-01 10:10:10'))->modify('+2 years'));
// Result: 2022-01-01 10:10:10
```

### `getNiceDateTimeFormat`

[](#getnicedatetimeformat)

The function `getNiceDateTimeFormat` returns a nice to read version of a given or, if first argument is null, the current [MySQL-Datetime-Formatted](https://dev.mysql.com/doc/refman/8.0/en/datetime.html) datetime.

By default, the function will create the current datetime. You can pass a [DateTime](https://www.php.net/manual/en/class.datetime) Instance to change the output.

Be default, the function used the current default Locale. You can set up a Locale somewhere in your code (before calling the function) or pass a locale as a string as the second parameter to the function.

#### Usage

[](#usage-1)

```
echo \basteyy\VariousPhpSnippets\getNiceDateTimeFormat();
// Result: current date time in format: May 01 22, 09:59 pm

echo \basteyy\VariousPhpSnippets\getDateTimeFormat((new DateTime('2020-01-01 10:10'))->modify('+2 years'), 'de');
// Result: 01. Januar 2022, 10:10

echo \basteyy\VariousPhpSnippets\getDateTimeFormat((new DateTime('2020-01-01 10:10'))->modify('+2 years'));
// Result: January 01 22, 10:10 am
```

### `remove_double_slashes`

[](#remove_double_slashes)

> Deprecated: Use `\basteyy\Stringer\removeDoubleSlashes` instead.

### `getRandomString`

[](#getrandomstring)

> Deprecated: Use `\basteyy\Stringer\getRandomString` instead.

### `slugify`

[](#slugify)

> Deprecated: Use `\basteyy\Stringer\slugify` instead.

### `varDebug`

[](#vardebug)

> Deprecated: Use `\varDebug` from `basteyy/var-debug` instead.

i18n
----

[](#i18n)

> Deprecated: Use `basteyy/php-i18n` instead.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

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 ~379 days

Total

3

Last Release

907d ago

PHP version history (2 changes)0.1.0PHP 8.1.\*

0.1.2PHP ^8.2|^8.1|^8.0

### Community

Maintainers

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

---

Top Contributors

[![basteyy](https://avatars.githubusercontent.com/u/2758879?v=4)](https://github.com/basteyy "basteyy (47 commits)")

---

Tags

phpfunctionssnippetsl18n

### Embed Badge

![Health badge](/badges/basteyy-various-php-snippets/health.svg)

```
[![Health](https://phpackages.com/badges/basteyy-various-php-snippets/health.svg)](https://phpackages.com/packages/basteyy-various-php-snippets)
```

###  Alternatives

[ilya/belt

A handful of tools for PHP developers.

71020.8k1](/packages/ilya-belt)[nilportugues/php_todo

Looks into the code using a user-defined list of to-do phrases and stops commit if the total amount increased or is above a threshold.

1210.0k](/packages/nilportugues-php-todo)

PHPackages © 2026

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