-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #4 : Drop laminas loader, module loader and autoloader provider…
… features Signed-off-by: Abdul Malik Ikhsan <[email protected]>
- Loading branch information
1 parent
6ccf180
commit a85820a
Showing
22 changed files
with
110 additions
and
1,125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Upgrading to 3.0 | ||
|
||
## Module autoloading | ||
|
||
laminas-modulemanager originates from before the Composer was created, where each | ||
framework had to provide its own autoloading implementation. | ||
Since then Composer became the de-facto standard in managing dependencies and | ||
autoloading for the php projects. | ||
In light of that, laminas-servicemanager removes ModuleLoader and autoload | ||
providers support in version 3.0 in favor of | ||
[Composer dependency manager](https://getcomposer.org/). | ||
|
||
### Application local modules | ||
|
||
Autoloading rules for application local modules should now be defined in | ||
application's composer.json | ||
|
||
Before: | ||
|
||
```php | ||
namespace Application; | ||
|
||
class Module | ||
{ | ||
public function getAutoloaderConfig() | ||
{ | ||
return [ | ||
'Laminas\Loader\StandardAutoloader' => [ | ||
'namespaces' => [ | ||
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, | ||
], | ||
], | ||
]; | ||
} | ||
} | ||
``` | ||
|
||
and after: | ||
|
||
```json | ||
{ | ||
"name": "laminas/laminas-mvc-skeleton", | ||
"description": "Laminas MVC Skeleton Application", | ||
"type": "project", | ||
... | ||
"autoload": { | ||
"psr-4": { | ||
"Application\\": "module/Application/src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"ApplicationTest\\": "module/Application/test/" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
[laminas-composer-autoloading](https://github.com/laminas/laminas-composer-autoloading) | ||
provides a handy tool to easily add and remove autoloading rules for local modules to | ||
application's composer.json | ||
|
||
After autoloading rules were updated, composer will need to update autoloader: | ||
|
||
```console | ||
$ composer dump-autoload | ||
``` | ||
|
||
### Composer installed modules | ||
|
||
For composer installed modules, autoloading rules will be automatically picked | ||
by composer from the module's composer.json and no extra effort is needed: | ||
```json | ||
{ | ||
"name": "acme/my-module", | ||
"description": "Module for use with laminas-mvc applications.", | ||
"type": "library", | ||
"require": { | ||
"php": "^7.1" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Acme\\MyModule\\": "src/" | ||
} | ||
} | ||
} | ||
``` |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.