PHPackages                             rayzor65/module-tutorial - 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. rayzor65/module-tutorial

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

rayzor65/module-tutorial
========================

Tutorial for creating a reusable module

1.0.4(10y ago)015MITPHPPHP &gt;=5.4

Since Dec 2Pushed 10y agoCompare

[ Source](https://github.com/adamsynnott/module-tutorial)[ Packagist](https://packagist.org/packages/rayzor65/module-tutorial)[ RSS](/packages/rayzor65-module-tutorial/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (6)Used By (0)

Write a reusable module
-----------------------

[](#write-a-reusable-module)

This is an example and mini tutorial on how to create a module that you can pull in with composer. It would be a good idea to have a basic understanding of autoloading and namespaces prior to creating your module.

### Writing the module

[](#writing-the-module)

- Copy this project into a new directory
- Edit the composer.json with the details of your module
- The autoload field means all the classes will be included under the specified namespace.
- Tag your module

    git tag 1.0.1

    git push origin --tags

### Including the module

[](#including-the-module)

Update your project's composer file.

Specify where the repo is

```
"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/rayzor65/module-tutorial" // Change this to your module
    }
]

```

Then add to require

```
    "require": {
        "rayzor65/module-tutorial": "1.0.1" // Change this to your module
    }

```

Now you may you the class in your project like so

```
use ModuleTutorial\MyModule\MyService;

class ProjectClass
{
    public function ProjectClassFunction()
    {
        // You can now use your autoloaded classes from the module
        $service = new MyService();
        $service->doSomething();
    }
}

```

### Final steps

[](#final-steps)

- Make sure you have put your own README instructions

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Total

5

Last Release

3856d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4434f242d222976fde36519b892b1d58b46f8b9b95eb82061638382177b6aaf4?d=identicon)[adamsynnott1](/maintainers/adamsynnott1)

---

Top Contributors

[![rayzor65](https://avatars.githubusercontent.com/u/4978547?v=4)](https://github.com/rayzor65 "rayzor65 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rayzor65-module-tutorial/health.svg)

```
[![Health](https://phpackages.com/badges/rayzor65-module-tutorial/health.svg)](https://phpackages.com/packages/rayzor65-module-tutorial)
```

PHPackages © 2026

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