PHPackages                             opentech/directories - 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. opentech/directories

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

opentech/directories
====================

A package to override the default folder structure of a laravel project

0.2.6(1y ago)011GPL-3.0-or-laterPHPPHP ^8.2

Since Mar 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/OpenTechSolutions/lara-directories)[ Packagist](https://packagist.org/packages/opentech/directories)[ RSS](/packages/opentech-directories/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (9)Used By (0)

24/04/2025

You don't need to do this!!!!!!
===============================

[](#you-dont-need-to-do-this)

This was an experiment, but you don't need to do this!!!

A simpler way is to just modify the `bootstrap/app.php` file and your `composer.json` file

Simply add `...... create()->useAppPath(__DIR__.'/../app/Infrastructure);`

Move all folders from `/app` into `app/Infrastruction` and then add other namespaces and modify namespace as you like in your psr-4 section of your composer.json file

```
"autoload": {
        "psr-4": {
            "Infrastructure\\": "app/Infrastructure/",
            "Domain\\": "app/Domain/",
            "Application\\": "app/Application/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
```

Still has some caveats with 3rd party packages that may hard code namespaces to Models and such, but there are ways around that too if you get creative by extending those files and binding your class over theirs, but they few and far between.

I like this structure, it mimics close to Hexagonal (ports and adapters) architecture pattern

Lara Directories Package
========================

[](#lara-directories-package)

**!!!! This is experimental and comes with some caveats !!!!**
The Laravel Directories package, `opentech/directories`, aims to provide a more flexible and organized directory structure for Laravel applications. By modifying the default Laravel configuration, you can break out of the default folder structure and separate your infrastructure, application, and domain logic.

```
app/
├── Infrastructure/
│   ├── Http/
│   │   ├── Controllers/
│   │   └── Routes/
│   ├── Models/
│   ├── Providers/
│   ├── View/
│   │   ├── Components/
│   │   └── Templates/
│
└── Domain/
└── Application/
```

Installation
------------

[](#installation)

1. Install the package using Composer:

```
composer require opentech/directories
```

2. Modify the `bootstrap/app.php` file to initialize the package's factory:

```
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use Opentech\Directories\ApplicationBuilderFactory;

$builder = ApplicationBuilderFactory::make(__DIR__);

return $builder
    ->withMiddleware(function (Middleware $middleware) {
    //
    })
    ->withExceptions(function (Exceptions $exceptions) {
        //
    })->create();
```

3. Publish the package's configuration file:

```
php artisan vendor:publish --provider="Opentech\Directories\DirectoriesServiceProvider" --tag="config"
```

This will create a new configuration file at `config/directories.php`. You can modify this file to customize the namespaces and paths according to your project's needs.

4. Move the routes files to the `Routes` folder:

By default, Laravel stores its routes in the `routes` directory. To use the package's modified routes structure, move the `web.php` and `console.php` files to the `Infrastructure/Http/Routes` folder. Update the `routes` configuration in the `config/directories.php` file accordingly.

Caveats
-------

[](#caveats)

- Laravel hard codes a lot of functionality into its artisan commands, so commands like installing the Broadcasting functionality (`php artisan install:broadcasting`) may not work due to this.
- To work around this, install the necessary packages before you hack the routes folder or create the `/routes/console.php` file if you moved it already.

Contributing
------------

[](#contributing)

Contributions are welcome! If you find any bugs or have suggestions for improvements, please open an issue or submit a pull request on the [GitHub repository](https://github.com/opentechsolutions/lara-directories).

License
-------

[](#license)

The Lara Directories package is open-sourced software licensed under the GNU General Public License v3.0.

Credits
-------

[](#credits)

This package was developed by [Ron Darby @ OpenTech Solutions](https://opentechsolutions.co.za/).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance47

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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

Total

8

Last Release

389d ago

### Community

Maintainers

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

---

Top Contributors

[![RonDarby](https://avatars.githubusercontent.com/u/3223084?v=4)](https://github.com/RonDarby "RonDarby (12 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/opentech-directories/health.svg)

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

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)

PHPackages © 2026

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