├── .gitignore
├── .coveralls.yml
├── tests
└── TestTest.php
├── .editorconfig
├── .travis.yml
├── src
├── config
│ └── optimus.components.php
├── ViewServiceProvider.php
├── TranslationServiceProvider.php
├── Utilities.php
├── Translation
│ └── DistributedFileLoader.php
└── RouteServiceProvider.php
├── composer.json
├── README.md
├── phpunit.xml
├── LICENSE
└── CONTRIBUTING.md
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | composer.phar
3 | composer.lock
4 | vendor
5 |
--------------------------------------------------------------------------------
/.coveralls.yml:
--------------------------------------------------------------------------------
1 | src_dir: src
2 | coverage_clover: build/logs/clover.xml
3 | json_path: build/logs/coveralls-upload.json
4 |
--------------------------------------------------------------------------------
/tests/TestTest.php:
--------------------------------------------------------------------------------
1 | assertTrue(true);
7 | }
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # editorconfig.org
2 | root = true
3 |
4 | [*]
5 | end_of_line = lf
6 | charset = utf-8
7 | trim_trailing_whitespace = true
8 | insert_final_newline = true
9 | indent_style = space
10 | indent_size = 4
11 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 | install:
3 | composer install
4 | php:
5 | - 5.5
6 | - 5.6
7 | - hhvm
8 |
9 | script:
10 | - mkdir -p build/logs
11 | - php vendor/bin/phpunit -c phpunit.xml
12 |
13 | after_script:
14 | - php vendor/bin/coveralls -v
15 |
--------------------------------------------------------------------------------
/src/config/optimus.components.php:
--------------------------------------------------------------------------------
1 | [
5 |
6 | ],
7 |
8 | 'protection_middleware' => [
9 |
10 | ],
11 |
12 | 'resource_namespace' => 'resources',
13 |
14 | 'language_folder_name' => 'lang',
15 |
16 | 'view_folder_name' => 'views'
17 | ];
18 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "optimus/distributed-laravel",
3 | "autoload": {
4 | "psr-4": {
5 | "Optimus\\Api\\System\\": "src/"
6 | }
7 | },
8 | "require": {
9 | "laravel/framework": "~8.0|~9.0|~10.0|~11.0"
10 | },
11 | "require-dev": {
12 | "mockery/mockery": "1.3.*",
13 | "orchestra/testbench": "4.*",
14 | "phpunit/phpunit": "~8.0",
15 | "php-coveralls/php-coveralls": "2.2.*"
16 | },
17 | "minimum-stability": "dev",
18 | "prefer-stable": true,
19 | "license": "MIT"
20 | }
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Distributed Laravel
2 |
3 | [](https://travis-ci.org/esbenp/distributed-laravel) [](https://coveralls.io/r/esbenp/distributed-laravel?branch=master)
4 |
5 | **Use 0.1.1 for Laravel 5.2 compatibility**
6 |
7 | Some service providers to enable a Laravel project structure that is grouped by components rather than class types.
8 |
9 | ## Installation
10 |
11 | ```bash
12 | composer require optimus/distributed-laravel 0.1.*
13 | ```
14 |
--------------------------------------------------------------------------------
/src/ViewServiceProvider.php:
--------------------------------------------------------------------------------
1 | app['config']['optimus.components'];
14 |
15 | $paths = Utilities::findNamespaceResources(
16 | $config['namespaces'],
17 | $config['view_folder_name'],
18 | $config['resource_namespace']
19 | );
20 |
21 | $this->app['config']['view.paths'] = array_merge($this->app['config']['view.paths'], $paths);
22 |
23 | parent::register();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 | ./src/
17 |
18 |
19 |
20 |
21 | ./tests/
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/TranslationServiceProvider.php:
--------------------------------------------------------------------------------
1 | app['config']['optimus.components'];
19 |
20 | $paths = Utilities::findNamespaceResources(
21 | $config['namespaces'],
22 | $config['language_folder_name'],
23 | $config['resource_namespace']
24 | );
25 |
26 | $this->app->singleton('translation.loader', function ($app) use ($paths) {
27 | return new DistributedFileLoader($app['files'], $paths);
28 | });
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Utilities.php:
--------------------------------------------------------------------------------
1 | paths = $paths;
22 | $this->files = $files;
23 | }
24 |
25 | /**
26 | * Load a locale from a given path.
27 | *
28 | * @param string $path
29 | * @param string $locale
30 | * @param string $group
31 | * @return array
32 | */
33 | protected function loadPath($path, $locale, $group)
34 | {
35 | $result = [];
36 | foreach ($this->paths as $path) {
37 | $result = array_merge($result, parent::loadPath($path, $locale, $group));
38 | }
39 |
40 | return $result;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | ### Commit Message Format
2 |
3 | [Angular.js commit message style](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#)
4 |
5 | Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
6 | format that includes a **type**, a **scope** and a **subject**:
7 |
8 | ```
9 | ():
10 |
11 |
12 |
13 |