Skip to content

Commit

Permalink
Merge pull request #3 from PreviewLinks/development
Browse files Browse the repository at this point in the history
Merge Development
  • Loading branch information
CraftLogan authored Dec 9, 2022
2 parents 48edf26 + c594a28 commit 016705f
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Security Policy

If you discover any security related issues, please email [email protected] instead of using the issue tracker.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

All notable changes to `php-previewify` will be documented in this file.
All notable changes to `php-previewlinks` will be documented in this file.

## 1.0.0 - 2022-01-07

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) Flowframe <[email protected]>
Copyright (c) PreviewLinks <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
29 changes: 12 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
# Previewify for PHP
# PreviewLinks for PHP

This is the official [Previewify](https://previewify.app) client for PHP.

## Support us

[<img src="https://flowfra.me/github-ad.png" width="419px" />](https://flowfra.me/github-ad-click)

Like our work? You can support us by purchasing one of our products.
This is the official [PreviewLinks](https://previewlinks.io) client for PHP.

## Installation

You can install the package via composer:

```bash
composer require flowframe/php-previewify
composer require previewlinks/php-previewlinks
```

## Usage
Expand All @@ -25,14 +19,14 @@ Use the `image` method to generate downloadable image URLs, be aware that this m
```php
<?php

use Flowframe\Previewify\Previewify;
use PreviewLinks\PreviewLinks;

$previewify = new Previewify('<YOUR_SITE_API_KEY>');
$previewlinks = new PreviewLinks('<YOUR_SITE_API_KEY>');

$response = $previewify->image(
$response = $previewlinks->image(
templateId: 1,
fields: [
'previewify:title' => 'Hello from PHP SDK',
'previewlinks:title' => 'Hello from PHP SDK',
],
);

Expand All @@ -48,14 +42,14 @@ Async images are perfect if you don't want to download the image or use meta tag
```php
<?php

use Flowframe\Previewify\Previewify;
use PreviewLinks\PreviewLinks;

$previewify = new Previewify('<YOUR_SITE_API_KEY>');
$previewlinks = new PreviewLinks('<YOUR_SITE_API_KEY>');

$url = $previewify->asyncImage(
$url = $previewlinks->asyncImage(
templateId: 1,
fields: [
'previewify:title' => 'Hello from PHP SDK',
'previewlinks:title' => 'Hello from PHP SDK',
],
);

Expand All @@ -68,6 +62,7 @@ Please review [our security policy](../../security/policy) on how to report secu

## Credits

- [Logan Craft](https://github.com/CraftLogan)
- [Lars Klopstra](https://github.com/flowframe)
- [All Contributors](../../contributors)

Expand Down
17 changes: 9 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"name": "flowframe/php-previewify",
"description": "The official PHP Previewify client",
"name": "previewlinks/php-previewlinks",
"description": "The official PHP Previewlinks client",
"keywords": [
"Flowframe",
"php-previewify"
"Previewlinks",
"php-previewlinks"
],
"homepage": "https://github.com/flowframe/php-previewify",
"homepage": "https://github.com/PreviewLinks/php-previewlinks",
"license": "MIT",
"authors": [
{
"name": "Lars Klopstra",
"email": "[email protected]",
"name": "Logan Craft",
"email": "[email protected]",
"role": "Developer"
}
],
Expand All @@ -25,12 +26,12 @@
},
"autoload": {
"psr-4": {
"Flowframe\\Previewify\\": "src"
"PreviewLinks\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Flowframe\\Previewify\\Tests\\": "tests"
"PreviewLinks\\Tests\\": "tests"
}
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
verbose="true"
>
<testsuites>
<testsuite name="Flowframe Test Suite">
<testsuite name="PreviewLinks Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
Expand Down
8 changes: 4 additions & 4 deletions src/Previewify.php → src/PreviewLinks.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php

namespace Flowframe\Previewify;
namespace PreviewLinks;

use Symfony\Component\HttpClient\HttpClient;
use Symfony\Contracts\HttpClient\ResponseInterface;

class Previewify
class PreviewLinks
{
public const IMAGE_ENDPOINT = 'https://previewify.app/api/image';
public const IMAGE_ENDPOINT = 'https://previewlinks.io/api/image';

public const ASYNC_IMAGE_ENDPOINT = 'https://previewify.app/api/async-image';
public const ASYNC_IMAGE_ENDPOINT = 'https://previewlinks.io/api/async-image';

public function __construct(
public string $apiKey,
Expand Down
14 changes: 7 additions & 7 deletions tests/PreviewifyTest.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php

use Flowframe\Previewify\Previewify;

use function PHPUnit\Framework\assertEquals;

use PreviewLinks\PreviewLinks;

it('can generate an async image', function () {
$previewify = new Previewify('test-key');
$previewlinks = new PreviewLinks('test-key');

$url = $previewify->asyncImage(1, [
'previewify:title' => 'Hi',
'previewify:description' => 'This is a test',
$url = $previewlinks->asyncImage(1, [
'previewlinks:title' => 'Hi',
'previewlinks:description' => 'This is a test',
]);

assertEquals(
'https://previewify.app/api/async-image?data=eyJ0ZW1wbGF0ZV9pZCI6MSwiZmllbGRzIjp7InByZXZpZXdpZnk6dGl0bGUiOiJIaSIsInByZXZpZXdpZnk6ZGVzY3JpcHRpb24iOiJUaGlzIGlzIGEgdGVzdCJ9fQ%3D%3D&signature=276956e53123b06bcf6a71624eb9a69a7e32cbfa72281ad53601fb24ae2468b8',
'https://previewlinks.io/api/async-image?data=eyJ0ZW1wbGF0ZV9pZCI6MSwiZmllbGRzIjp7InByZXZpZXdsaW5rczp0aXRsZSI6IkhpIiwicHJldmlld2xpbmtzOmRlc2NyaXB0aW9uIjoiVGhpcyBpcyBhIHRlc3QifX0%3D&signature=8f690cf87aa9994a42eb7d4920788c6643a1cc9ec0025ec77a912052921af1f6',
$url,
);
});

0 comments on commit 016705f

Please sign in to comment.