Skip to content

Commit

Permalink
Merge pull request #35 from hydephp/add-package-autodiscovery
Browse files Browse the repository at this point in the history
v0.36.x - Add package auto-discovery
  • Loading branch information
caendesilva committed Jun 15, 2022
1 parent 19c1dc3 commit 595dd30
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/Application.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Hyde\Framework;

use Illuminate\Filesystem\Filesystem;
use Illuminate\Foundation\PackageManifest;

class Application extends \LaravelZero\Framework\Application
{
/**
* {@inheritdoc}
*/
protected function registerBaseBindings(): void
{
parent::registerBaseBindings();

/*
* Enable auto-discovery.
*/
$this->app->singleton(PackageManifest::class, function () {
return new PackageManifest(
new Filesystem, $this->basePath(), $this->basePath('storage/framework/cache/packages.php')
);
});
}
}
18 changes: 18 additions & 0 deletions src/Commands/HydePackageDiscoverCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Hyde\Framework\Commands;

use Hyde\Framework\Hyde;
use Illuminate\Foundation\Console\PackageDiscoverCommand as BaseCommand;
use Illuminate\Foundation\PackageManifest;

class HydePackageDiscoverCommand extends BaseCommand
{
protected $hidden = true;

public function handle(PackageManifest $manifest)
{
$manifest->manifestPath = Hyde::path('storage/framework/cache/packages.php');
parent::handle($manifest);
}
}
2 changes: 2 additions & 0 deletions src/HydeServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ function () {
Commands\HydeInstallCommand::class,
Commands\HydeDebugCommand::class,
Commands\HydeServeCommand::class,

Commands\HydePackageDiscoverCommand::class,
]);
}

Expand Down

0 comments on commit 595dd30

Please sign in to comment.