diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..7428907 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,18 @@ +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 + +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + labels: + - "dependencies" + + - package-ecosystem: "composer" + directory: "/" + schedule: + interval: "weekly" + labels: + - "dependencies" diff --git a/README.md b/README.md index cb6ab14..794834d 100644 --- a/README.md +++ b/README.md @@ -6,15 +6,26 @@ # Identity-contract -**Require PHP >= 8.0** +| PHP Version | Package version | +| ---------- | ---------------- | +| PHP >= 8.2 | v2.0 | +| PHP >= 8.0 | v1.1 | -Propose basic abstract classes to manage Identities in Domain project. +This package propose abstract classes to manage Identities in DDD projects. +## Features + +Builtin typed identities : - integer based identities - string based identities - uuid based identities -# Usage +Also: +- instance are readonly +- equality test +- request same identity twice return same object + +## Usage **Int Identity** ```PHP @@ -34,5 +45,11 @@ $id = UserId::from("d2fbc6c0-0497-42f1-8ece-8840641b67f0"); // or $id = UserId::new(); -``` +// Generating twice same identity return same object + +$id1 = UserId::from("d2fbc6c0-0497-42f1-8ece-8840641b67f0"); +$id2 = UserId::from("d2fbc6c0-0497-42f1-8ece-8840641b67f0"); + +var_dump($id1 === $id2); // true +```