PHPackages                             grithin/file-include - 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. grithin/file-include

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

grithin/file-include
====================

Include files in isolated context with options

0.1(4y ago)091MITPHPPHP &gt;=5.3.0

Since Jul 20Pushed 4y ago1 watchersCompare

[ Source](https://github.com/grithin/php-file-include)[ Packagist](https://packagist.org/packages/grithin/file-include)[ Docs](https://github.com/grithin/php-file-include)[ RSS](/packages/grithin-file-include/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

FileInclude
===========

[](#fileinclude)

For including files in an isolated context, but with injected variables, and potentially extracted variables.

```
composer require grithin/file-include
```

Use
---

[](#use)

```
use \Grithin\FileInclude;
# inject `bob` into the file context, so file code can access $bob
FileInclude::include('file.php', ['bob'=>$bob]);

# inject the global $bob into the file
global $bob;
FileInclude::require_once('file2.php', null, ['globals'=>['bob']]);
```

### Extraction

[](#extraction)

Extraction will adjust the return value. Whereas, normally, the return value is the return of the file, when variables are being extracted, the return changes into an array, where the normal return can be found in `['_return'=>$x]`

file.php

```
$bob = 'bob';
return 123;
```

```
$result = FileInclude::include_once('file.php', null, ['extract'=>['bob']]);
/*>
[
	'_return'=>123,
	'bob'=>'bob'
]
*/
```

Notes
-----

[](#notes)

This is a rewrite and selection from \\Grithin\\Files in phpbase

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

1763d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4543facab3c88d548b98d8472b532faf7bcd00555cc47c0dc808d935f8d3d73f?d=identicon)[grithin](/maintainers/grithin)

---

Top Contributors

[![grithin](https://avatars.githubusercontent.com/u/7241358?v=4)](https://github.com/grithin "grithin (2 commits)")

---

Tags

file include

### Embed Badge

![Health badge](/badges/grithin-file-include/health.svg)

```
[![Health](https://phpackages.com/badges/grithin-file-include/health.svg)](https://phpackages.com/packages/grithin-file-include)
```

PHPackages © 2026

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