Skip to content

Commit

Permalink
feat: add Lexicon types and draft parser
Browse files Browse the repository at this point in the history
  • Loading branch information
ramsey committed May 1, 2023
1 parent fcdee98 commit f3f20d7
Show file tree
Hide file tree
Showing 28 changed files with 1,051 additions and 16 deletions.
30 changes: 14 additions & 16 deletions README.md
Expand Up @@ -4,21 +4,15 @@
<strong>A PHP-based Lexicon parser for applications using the AT Protocol</strong>
</p>

<!--
TODO: Make sure the following URLs are correct and working for your project.
Then, remove these comments to display the badges, giving users a quick
overview of your package.
<p align="center">
<a href="https://github.com/socialweb-php/atproto-lexicon"><img src="https://img.shields.io/badge/source-socialweb/atproto--lexicon-blue.svg?style=flat-square" alt="Source Code"></a>
<a href="https://packagist.org/packages/socialweb/atproto-lexicon"><img src="https://img.shields.io/packagist/v/socialweb/atproto-lexicon.svg?style=flat-square&label=release" alt="Download Package"></a>
<a href="https://php.net"><img src="https://img.shields.io/packagist/php-v/socialweb/atproto-lexicon.svg?style=flat-square&colorB=%238892BF" alt="PHP Programming Language"></a>
<a href="https://github.com/socialweb-php/atproto-lexicon/blob/main/LICENSE"><img src="https://img.shields.io/packagist/l/socialweb/atproto-lexicon.svg?style=flat-square&colorB=darkcyan" alt="Read License"></a>
<a href="https://github.com/socialweb-php/atproto-lexicon/blob/main/NOTICE"><img src="https://img.shields.io/packagist/l/socialweb/atproto-lexicon.svg?style=flat-square&colorB=darkcyan" alt="Read License"></a>
<a href="https://github.com/socialweb-php/atproto-lexicon/actions/workflows/continuous-integration.yml"><img src="https://img.shields.io/github/actions/workflow/status/socialweb-php/atproto-lexicon/continuous-integration.yml?branch=main&style=flat-square&logo=github" alt="Build Status"></a>
<a href="https://codecov.io/gh/socialweb-php/atproto-lexicon"><img src="https://img.shields.io/codecov/c/gh/socialweb-php/atproto-lexicon?label=codecov&logo=codecov&style=flat-square" alt="Codecov Code Coverage"></a>
<a href="https://shepherd.dev/github/socialweb-php/atproto-lexicon"><img src="https://img.shields.io/endpoint?style=flat-square&url=https%3A%2F%2Fshepherd.dev%2Fgithub%2Fsocialweb-php%2Fatproto-lexicon%2Fcoverage" alt="Psalm Type Coverage"></a>
</p>
-->

## About

Expand All @@ -34,20 +28,24 @@ Install this package as a dependency using [Composer](https://getcomposer.org).
composer require socialweb/atproto-lexicon
```

<!--
## Usage

Provide a brief description or short example of how to use this library.
If you need to provide more detailed examples, use the `docs/` directory
and provide a link here to the documentation.
``` php
use SocialWeb\Atproto\Lexicon\Example;
use SocialWeb\Atproto\Lexicon\Parser\LexiconParser;

$parser = new LexiconParser(
documentPath: '/path/to/bluesky-social/atproto/lexicons/app/bsky/feed/post.json',
schemaPath: '/path/to/bluesky-social/atproto/lexicons',
resolveReferences: true,
);

$document = $parser->parse();

$example = new Example();
echo $example->greet('fellow human');
// This isn't necessary, but it uses jq to print the JSON and remove null
// values, so you can see that what we parsed is very close to what we consumed.
$json = (string) json_encode($document);
passthru('echo ' . escapeshellarg($json) . ' | jq -C "del(..|nulls)"');
```
-->

## Contributing

Expand Down
11 changes: 11 additions & 0 deletions src/LexiconException.php
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

namespace SocialWeb\Atproto\Lexicon;

use Throwable;

interface LexiconException extends Throwable
{
}

0 comments on commit f3f20d7

Please sign in to comment.