Resolve AT Protocol DIDs, handles, and schemas with intelligent caching for Laravel

Initial commit

Miguel Batres 81458162

+5
.gitignore
··· 1 + .DS_Store 2 + .phpunit.result.cache 3 + .php-cs-fixer.cache 4 + composer.lock 5 + /vendor
+27
CONTRIBUTING.md
··· 1 + # Contributing 2 + 3 + Contributions are welcome and will be fully credited. 4 + 5 + Contributions are accepted via Pull Requests on [Github](https://github.com/social-dept/beacon). 6 + 7 + # Things you could do 8 + If you want to contribute but do not know where to start, this list provides some starting points. 9 + - Add license text 10 + - Remove rewriteRules.php 11 + - Set up TravisCI, StyleCI, ScrutinizerCI 12 + - Write a comprehensive ReadMe 13 + 14 + ## Pull Requests 15 + 16 + - **Add tests!** - Your patch won't be accepted if it doesn't have tests. 17 + 18 + - **Document any change in behaviour** - Make sure the `readme.md` and any other relevant documentation are kept up-to-date. 19 + 20 + - **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. 21 + 22 + - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. 23 + 24 + - **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. 25 + 26 + 27 + **Happy coding**!
+5
LICENSE
··· 1 + # The license 2 + 3 + Copyright (c) Author Name <author@email.com> 4 + 5 + ...Add your license text here...
+57
README.md
··· 1 + # Beacon 2 + 3 + [![Latest Version on Packagist][ico-version]][link-packagist] 4 + [![Total Downloads][ico-downloads]][link-downloads] 5 + [![Build Status][ico-travis]][link-travis] 6 + [![StyleCI][ico-styleci]][link-styleci] 7 + 8 + This is where your description should go. Take a look at [contributing.md](CONTRIBUTING.md) to see a to do list. 9 + 10 + ## Installation 11 + 12 + Via Composer 13 + 14 + ```bash 15 + composer require social-dept/beacon 16 + ``` 17 + 18 + ## Usage 19 + 20 + ## Change log 21 + 22 + Please see the [changelog](changelog.md) for more information on what has changed recently. 23 + 24 + ## Testing 25 + 26 + ```bash 27 + composer test 28 + ``` 29 + 30 + ## Contributing 31 + 32 + Please see [contributing.md](CONTRIBUTING.md) for details and a todolist. 33 + 34 + ## Security 35 + 36 + If you discover any security related issues, please email author@email.com instead of using the issue tracker. 37 + 38 + ## Credits 39 + 40 + - [Author Name][link-author] 41 + - [All Contributors][link-contributors] 42 + 43 + ## License 44 + 45 + MIT. Please see the [license file](LICENSE) for more information. 46 + 47 + [ico-version]: https://img.shields.io/packagist/v/social-dept/beacon.svg?style=flat-square 48 + [ico-downloads]: https://img.shields.io/packagist/dt/social-dept/beacon.svg?style=flat-square 49 + [ico-travis]: https://img.shields.io/travis/social-dept/beacon/master.svg?style=flat-square 50 + [ico-styleci]: https://styleci.io/repos/12345678/shield 51 + 52 + [link-packagist]: https://packagist.org/packages/social-dept/beacon 53 + [link-downloads]: https://packagist.org/packages/social-dept/beacon 54 + [link-travis]: https://travis-ci.org/social-dept/beacon 55 + [link-styleci]: https://styleci.io/repos/12345678 56 + [link-author]: https://github.com/social-dept 57 + [link-contributors]: ../../contributors
+41
composer.json
··· 1 + { 2 + "name": "socialdept/atp-beacon", 3 + "description": ":package_description", 4 + "license": "MIT", 5 + "authors": [ 6 + { 7 + "name": "Author Name", 8 + "email": "author@email.com", 9 + "homepage": "http://author.com" 10 + } 11 + ], 12 + "homepage": "https://github.com/social-dept/beacon", 13 + "keywords": ["Laravel", "Beacon"], 14 + "require": { 15 + "illuminate/support": "~9" 16 + }, 17 + "require-dev": { 18 + "phpunit/phpunit": "~9.0", 19 + "orchestra/testbench": "~7" 20 + }, 21 + "autoload": { 22 + "psr-4": { 23 + "SocialDept\\Beacon\\": "src/" 24 + } 25 + }, 26 + "autoload-dev": { 27 + "psr-4": { 28 + "SocialDept\\Beacon\\Tests\\": "tests" 29 + } 30 + }, 31 + "extra": { 32 + "laravel": { 33 + "providers": [ 34 + "SocialDept\\Beacon\\BeaconServiceProvider" 35 + ], 36 + "aliases": { 37 + "Beacon": "SocialDept\\Beacon\\Facades\\Beacon" 38 + } 39 + } 40 + } 41 + }
+5
config/beacon.php
··· 1 + <?php 2 + 3 + return [ 4 + // 5 + ];
+22
phpunit.xml
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <phpunit bootstrap="vendor/autoload.php" 3 + backupGlobals="false" 4 + backupStaticAttributes="false" 5 + colors="true" 6 + verbose="true" 7 + convertErrorsToExceptions="true" 8 + convertNoticesToExceptions="true" 9 + convertWarningsToExceptions="true" 10 + processIsolation="false" 11 + stopOnFailure="false"> 12 + <testsuites> 13 + <testsuite name="Package"> 14 + <directory suffix=".php">./tests/</directory> 15 + </testsuite> 16 + </testsuites> 17 + <filter> 18 + <whitelist> 19 + <directory>src/</directory> 20 + </whitelist> 21 + </filter> 22 + </phpunit>
+8
src/Beacon.php
··· 1 + <?php 2 + 3 + namespace SocialDept\Beacon; 4 + 5 + class Beacon 6 + { 7 + // Build wonderful things 8 + }
+82
src/BeaconServiceProvider.php
··· 1 + <?php 2 + 3 + namespace SocialDept\Beacon; 4 + 5 + use Illuminate\Support\ServiceProvider; 6 + 7 + class BeaconServiceProvider extends ServiceProvider 8 + { 9 + /** 10 + * Perform post-registration booting of services. 11 + * 12 + * @return void 13 + */ 14 + public function boot(): void 15 + { 16 + // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'social-dept'); 17 + // $this->loadViewsFrom(__DIR__.'/../resources/views', 'social-dept'); 18 + // $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); 19 + // $this->loadRoutesFrom(__DIR__.'/routes.php'); 20 + 21 + // Publishing is only necessary when using the CLI. 22 + if ($this->app->runningInConsole()) { 23 + $this->bootForConsole(); 24 + } 25 + } 26 + 27 + /** 28 + * Register any package services. 29 + * 30 + * @return void 31 + */ 32 + public function register(): void 33 + { 34 + $this->mergeConfigFrom(__DIR__.'/../config/beacon.php', 'beacon'); 35 + 36 + // Register the service the package provides. 37 + $this->app->singleton('beacon', function ($app) { 38 + return new Beacon; 39 + }); 40 + } 41 + 42 + /** 43 + * Get the services provided by the provider. 44 + * 45 + * @return array 46 + */ 47 + public function provides() 48 + { 49 + return ['beacon']; 50 + } 51 + 52 + /** 53 + * Console-specific booting. 54 + * 55 + * @return void 56 + */ 57 + protected function bootForConsole(): void 58 + { 59 + // Publishing the configuration file. 60 + $this->publishes([ 61 + __DIR__.'/../config/beacon.php' => config_path('beacon.php'), 62 + ], 'beacon.config'); 63 + 64 + // Publishing the views. 65 + /*$this->publishes([ 66 + __DIR__.'/../resources/views' => base_path('resources/views/vendor/social-dept'), 67 + ], 'beacon.views');*/ 68 + 69 + // Publishing assets. 70 + /*$this->publishes([ 71 + __DIR__.'/../resources/assets' => public_path('vendor/social-dept'), 72 + ], 'beacon.assets');*/ 73 + 74 + // Publishing the translation files. 75 + /*$this->publishes([ 76 + __DIR__.'/../resources/lang' => resource_path('lang/vendor/social-dept'), 77 + ], 'beacon.lang');*/ 78 + 79 + // Registering package commands. 80 + // $this->commands([]); 81 + } 82 + }
+18
src/Facades/Beacon.php
··· 1 + <?php 2 + 3 + namespace SocialDept\Beacon\Facades; 4 + 5 + use Illuminate\Support\Facades\Facade; 6 + 7 + class Beacon extends Facade 8 + { 9 + /** 10 + * Get the registered name of the component. 11 + * 12 + * @return string 13 + */ 14 + protected static function getFacadeAccessor(): string 15 + { 16 + return 'beacon'; 17 + } 18 + }