Compare commits

..

6 Commits

Author SHA1 Message Date
jay ff5aeeacef add Behaviour 2026-08-12 15:20:32 -04:00
jay e34c7f6769 require potter/container 2026-08-12 15:14:00 -04:00
jay e41b8d6ff5 extend \Dotenv\Dotenv 2026-08-12 15:12:26 -04:00
jay 65690c75c8 create Environment 2026-08-12 15:06:05 -04:00
jay a882152935 composer init 2026-08-12 15:05:43 -04:00
jay 232ad6b0d0 create .gitignore 2026-08-12 15:04:07 -04:00
4 changed files with 71 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
composer.lock
/nbproject/
/vendor/
+26
View File
@@ -0,0 +1,26 @@
{
"name": "potter/environment",
"type": "library",
"license": "MIT",
"autoload": {
"psr-4": {
"Potter\\Environment\\": "src/Potter/Environment/"
}
},
"authors": [
{
"name": "Jay Potter",
"email": "j@ypotter.ca"
}
],
"minimum-stability": "stable",
"require": {
"graham-campbell/result-type": ">=1.1.4",
"phpoption/phpoption": ">=1.9.5",
"potter/container": ">=0.0.1",
"symfony/polyfill-ctype": ">=1.37.0",
"symfony/polyfill-mbstring": ">=1.38.2",
"symfony/polyfill-php80": ">=1.37.0",
"vlucas/phpdotenv": ">=5.6.4"
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace Potter\Environment;
use \Potter\Container;
trait Behaviour
{
private static function addEnvironment(Container $container): void
{
$container->addShared(Environment::class, function () {
return Environment::createImmutable(getcwd());
});
}
private static function addEnvironmentBehaviour(Container $container): void
{
static::addEnvironment($container);
self::getEnvironment($container)->required(['APPLICATION_NAME']);
}
private static function getEnvironment(Container $container): Environment
{
return $container->get(Environment::class);
}
private static function hasEnvironment(Container $container): bool
{
return $container->has(Environment::class);
}
}
+9
View File
@@ -0,0 +1,9 @@
<?php
declare(strict_types=1);
namespace Potter\Environment;
final class Environment
extends \Dotenv\Dotenv
{ }