Compare commits

..

15 Commits

Author SHA1 Message Date
jay ae21edd5bb remove has 2026-08-12 16:12:23 -04:00
jay a793b842b1 re-namespace 2026-08-12 16:02:02 -04:00
jay e664b84072 re-namespace and remove class 2026-08-12 16:01:10 -04:00
jay 6318a565ec remove required() 2026-08-12 15:53:02 -04:00
jay 4adc20284c change static to self 2026-08-12 15:37:20 -04:00
jay 7e2ee30244 call ->load() 2026-08-12 15:34:59 -04:00
jay 622b69f82d fix typeerror 2026-08-12 15:26:54 -04:00
jay af5ca24364 spacing 2026-08-12 15:21:22 -04:00
jay e0ac5c6e1f delete 2026-08-12 15:20:43 -04:00
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 58 additions and 2 deletions
+3
View File
@@ -0,0 +1,3 @@
composer.lock
/nbproject/
/vendor/
-2
View File
@@ -1,2 +0,0 @@
# Environment
+26
View File
@@ -0,0 +1,26 @@
{
"name": "potter/environment",
"type": "library",
"license": "MIT",
"autoload": {
"psr-4": {
"Potter\\": "src/Potter/"
}
},
"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"
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace Potter;
use \Dotenv\Dotenv;
use \Potter\Container;
trait Environment
{
private static function addEnvironment(Container $container): void
{
$container->addShared(Dotenv::class, function () {
return Dotenv::createImmutable(getcwd()); });
}
private static function addEnvironmentBehaviour(Container $container): void
{
self::addEnvironment($container);
$environment = self::getEnvironment($container);
$environment->load();
}
private static function getEnvironment(Container $container): Dotenv
{
return $container->get(Dotenv::class);
}
}