abr4xas/publish-to-dev-to

publish-to-dev-to

v0.0.1 2021-01-06 22:43 UTC

This package is auto-updated.

Last update: 2024-04-07 06:38:56 UTC


README

Latest Version on Packagist Total Downloads

This is where your description should go. Try and limit it to a paragraph or two. Consider adding a small example.

Installation

You can install the package via composer:

composer require abr4xas/publish-to-dev-to

To create an article you need to pass an array like this:

<?php
require 'vendor/autoload.php';

$articleToPost = [
    'article' => [
        'title' => 'Hello, World! From the dev.to API',
        'body_markdown' => 'This my markdown body text',
        'description' => 'Hello, World! From the dev.to API <3',
        'cover_image' => 'https://i.pinimg.com/originals/97/90/12/979012800b47e3bb871cae4009333e08.jpg',
        'tags' => [
            'hello',
            'world'
        ],
    ],
];

try {

    $devTo = (new \Abr4xas\PublishToDevTo\PublishTo('<YOUR_API_KEY>'))
        ->devToMyArticle($articleToPost);

} catch (\Abr4xas\PublishToDevTo\Exceptions\GenericException $e) {
    //
} catch (\GuzzleHttp\Exception\ClientException $e) {
    //
}

Testing

// todo

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.