PHPackages                             achyutn/laravel-news-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. achyutn/laravel-news-sdk

ActiveLibrary[API Development](/categories/api)

achyutn/laravel-news-sdk
========================

A simple PHP SDK for submitting links to Laravel News.

v1.0.4(4mo ago)1333MITPHPPHP ^8.2|^8.3|^8.4CI failing

Since Jan 8Pushed 4mo agoCompare

[ Source](https://github.com/achyutkneupane/laravel-news-sdk)[ Packagist](https://packagist.org/packages/achyutn/laravel-news-sdk)[ Fund](https://www.buymeacoffee.com/achyutn)[ Fund](https://buymemomo.com/achyut)[ RSS](/packages/achyutn-laravel-news-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (6)Versions (6)Used By (0)

Laravel News SDK
================

[](#laravel-news-sdk)

[![Lint & Test PR](https://github.com/achyutkneupane/laravel-news-sdk/actions/workflows/prlint.yml/badge.svg)](https://github.com/achyutkneupane/laravel-news-sdk/actions/workflows/prlint.yml)

A simple PHP SDK for submitting links to [Laravel News](https://laravel-news.com) using their API.

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Laravel 10.0 or higher

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require achyutn/laravel-news-sdk
```

Configuration
-------------

[](#configuration)

After installing, publish the configuration file:

```
php artisan vendor:publish --tag="laravel-news"
```

This will create a `config/laravel-news.php` file.

Next, set your Laravel News API token in your `.env` file:

```
LARAVEL_NEWS_TOKEN=your-api-token-here
```

You can obtain an API token from [Laravel News](https://laravel-news.com/user/api-tokens).

Usage
-----

[](#usage)

### Using the Facade

[](#using-the-facade)

```
use AchyutN\LaravelNews\Facades\LaravelNews;
use AchyutN\LaravelNews\Data\Link;
use AchyutN\LaravelNews\Enums\LinkCategory;

$link = new Link(
    title: 'Filament Log Viewer',
    url: 'https://packagist.org/packages/achyutn/filament-log-viewer',
    category: LinkCategory::Package
);

$item = LaravelNews::post($link);

// The item is a Link DTO populated with server-side data
echo $item->id;
echo $item->createdAt;
```

### Using Dependency Injection

[](#using-dependency-injection)

```
use AchyutN\LaravelNews\LaravelNews;

class SomeController
{
    public function __construct(
        private LaravelNews $laravelNews
    ) {}

    public function submitLink()
    {
        $link = new Link(
            title: 'Cool Tutorial',
            url: 'https://example.com/tutorial'
        );

        $item = $this->laravelNews->post($link);
    }
}
```

API Reference
-------------

[](#api-reference)

### LaravelNews

[](#laravelnews)

The main class for interacting with the Laravel News API.

#### `post(Link $link): Link`

[](#postlink-link-link)

Submits a link and returns a populated Link instance.

- **Throws**: `AchyutN\LaravelNews\Exceptions\LaravelNewsException` if the API returns an error or the token is missing.

### Link

[](#link)

The core Data Transfer Object for submitting links.

Properties:

- `string $title` (Required, max 100 chars)
- `string $url` (Required, valid URL)
- `LinkCategory|null $category`
- `int|null $id` (Populated after response)
- `int|null $userId` (Populated after response)
- `Carbon|null $createdAt`
- `Carbon|null $updatedAt`

#### `toPostArray(): array`

[](#topostarray-array)

Converts the DTO into the format expected by the Laravel News API for submission.

#### `fromArray(array $data): self`

[](#fromarrayarray-data-self)

Creates a `Link` item from API response data.

### LinkCategory

[](#linkcategory)

Enum for link categories.

- `LinkCategory::Tutorial`
- `LinkCategory::Package`

Contributing
------------

[](#contributing)

Contributions are welcome! Please create a pull request or open an issue if you find any bugs or have feature requests.

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE.md).

Support
-------

[](#support)

If you find this package useful, please consider starring the repository on GitHub to show your support.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance77

Regular maintenance activity

Popularity16

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

5

Last Release

123d ago

PHP version history (2 changes)v1.0.0PHP &gt;=8.1

v1.0.1PHP ^8.2|^8.3|^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/52259760?v=4)[achyutn](/maintainers/achyutn)[@AchyutN](https://github.com/AchyutN)

---

Top Contributors

[![achyutkneupane](https://avatars.githubusercontent.com/u/30431426?v=4)](https://github.com/achyutkneupane "achyutkneupane (53 commits)")

---

Tags

apilaravellaravel-newssdkapilaravelsdk newslinks

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/achyutn-laravel-news-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/achyutn-laravel-news-sdk/health.svg)](https://phpackages.com/packages/achyutn-laravel-news-sdk)
```

###  Alternatives

[resend/resend-laravel

Resend for Laravel

1191.4M6](/packages/resend-resend-laravel)[essa/api-tool-kit

set of tools to build an api with laravel

52680.5k](/packages/essa-api-tool-kit)[missael-anda/laravel-whatsapp

A Whatsapp Business Cloud API wrapper for Laravel.

677.5k](/packages/missael-anda-laravel-whatsapp)[dragon-code/laravel-json-response

Automatically always return a response in JSON format

1118.6k1](/packages/dragon-code-laravel-json-response)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
