Neuron-PHP

Creator
in package
implements IPostCreator

Post creation service.

Creates new posts with categories and tags relationships.

Table of Contents

Interfaces

IPostCreator
Post creation service interface

Properties

$_categoryRepository  : ICategoryRepository
$_postRepository  : IPostRepository
$_slugGenerator  : SlugGenerator
$_tagResolver  : Resolver

Methods

__construct()  : mixed
create()  : Post
Create a new post from DTO
generateSlug()  : string
Generate URL-friendly slug from title

Properties

Methods

create()

Create a new post from DTO

public create(Dto $request[, array<string|int, mixed> $categoryIds = [] ][, string $tagNames = '' ]) : Post
Parameters
$request : Dto

DTO containing title, content, author_id, status, slug, excerpt, featured_image

$categoryIds : array<string|int, mixed> = []

Array of category IDs

$tagNames : string = ''

Comma-separated tag names

Return values
Post

generateSlug()

Generate URL-friendly slug from title

private generateSlug(string $title) : string

For titles with only non-ASCII characters (e.g., "你好", "مرحبا"), generates a fallback slug using a unique identifier.

Parameters
$title : string
Return values
string

        
On this page

Search results