Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elistone/social-share-preview
Generate social share previews
https://github.com/elistone/social-share-preview
Last synced: 19 days ago
JSON representation
Generate social share previews
- Host: GitHub
- URL: https://github.com/elistone/social-share-preview
- Owner: elistone
- Created: 2021-09-13T15:21:06.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-14T09:22:15.000Z (over 3 years ago)
- Last Synced: 2024-11-22T23:45:45.728Z (3 months ago)
- Language: PHP
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Social Share Preview
The social share preview is a library designed to pass in certain content such as title, description, image url & a web url then request a preview will be generated based upon certain social media sites.## Install
### Composer *Recommend*
```
composer require elistone/social-share-preview
```### Manually
Download this package manually and add it to your projected
## Usage
```php
// init preview library.
$preview = new Preview();// set the common content.
$preview->setTitle("This is my example title");
$preview->setDescription("This is my example description");
$preview->setImageUrl("https://source.unsplash.com/random");
$preview->setUrl("https://example.com");// set the type of preview.
$preview->setType("facebook"); // Facebook, LinkedIn or Twitter.// generate and display the preview.
echo $preview->generate();
```## Styling
This library contains some basic styling for the generated output this can be found at `css/social-share-preview.css`.
## Example
There is an example file found in this project which can be launched with php serve.
```
php -S localhost:8001
```
Then visiting http://localhost:8001/example.php will load the example.