turahe/post

A package for managing posts.

v1.2.1 2025-08-05 13:57 UTC

This package is auto-updated.

Last update: 2025-08-05 14:23:39 UTC


README

Tests Release Latest Version PHP Version Laravel Version Code Coverage License Stars Forks Issues Pull Requests

๐Ÿ“ Turahe Post

A powerful Laravel package for managing posts with rich content, markdown support, and comprehensive testing.

Packagist Packagist Downloads Packagist License

๐Ÿš€ Quick Start

composer require turahe/post

๐Ÿ“ฆ Installation

Step 1: Install Package

composer require turahe/post

Step 2: Publish Resources

php artisan vendor:publish --provider="Turahe\Post\PostServiceProvider"

Step 3: Run Migrations

php artisan migrate

Step 4: Done! ๐ŸŽ‰

Your post management system is ready to use.

โœจ Features

Feature Status Description
๐ŸŽฏ Post Management โœ… Ready Create, update, and manage posts with ease
๐Ÿ“ Content Support โœ… Ready Rich content with markdown conversion
๐Ÿ”— Slug Generation โœ… Ready Automatic slug generation from titles
๐Ÿ—‘๏ธ Soft Deletes โœ… Ready Safe deletion with data preservation
๐Ÿ‘ค User Stamps โœ… Ready Track who created and modified posts
๐Ÿ“Š Sorting โœ… Ready Flexible post ordering and sorting
๐Ÿ“ข Publishing โœ… Ready Control post publication status
๐ŸŒ Multi-language โœ… Ready Support for different languages
๐Ÿงช Comprehensive Testing โœ… Ready 21 tests with 79 assertions
๐ŸŽจ Code Quality โœ… Ready PSR-12 compliant with Laravel Pint

๐Ÿš€ Quick Start

๐Ÿ“ Basic Usage

use Turahe\Post\Models\Post;

// Create a post
$post = Post::create([
    'title' => 'My First Post',
    'subtitle' => 'A subtitle',
    'description' => 'Post description',
    'type' => 'post',
]);

// Add content with markdown
$post->setContents('# Hello World\n\nThis is **markdown** content.');

// Get formatted content
echo $post->content; // HTML output
echo $post->content_raw; // Raw markdown

๐Ÿ“Š Content Management

// Get the latest content
$content = $post->getContent();

// Get word count and read time
echo $content->word_count; // Number of words
echo $content->read_time['text']; // "2 minutes"

๐Ÿ“ข Publishing Posts

// Publish a post
$post->update(['published_at' => now()]);

// Get published posts
$published = Post::published()->get();

// Get draft posts
$drafts = Post::notPublished()->get();

๐Ÿค Contributing

We welcome contributions! Please ensure:

๐Ÿ“‹ Requirements

  • โœ… Code Quality: Run composer check before submitting
  • โœ… Test Coverage: Maintain or improve test coverage
  • โœ… Documentation: Update documentation as needed

๐Ÿงช Testing Guidelines

  • Write tests for new features
  • Ensure existing tests pass
  • Aim for 90%+ code coverage
  • Test both happy path and edge cases

๐Ÿ“Š Coverage Requirements

  • New Features: Must have 90%+ coverage
  • Bug Fixes: Must include regression tests
  • Refactoring: Must maintain existing coverage levels

๐Ÿ“ˆ Coverage Reports

For detailed coverage analysis, see:

  • ๐Ÿ“„ COVERAGE_REPORT.md - Comprehensive coverage analysis
  • ๐ŸŒ coverage/index.html - Visual HTML report
  • ๐Ÿ“Š coverage.xml - XML data for CI/CD

๐Ÿ› ๏ธ Development

๐Ÿงช Testing

# Run the test suite
composer test

# Run tests with coverage
composer test-coverage

๐ŸŽจ Code Quality

# Check code style
composer pint-test

# Fix code style issues
composer pint

# Run all quality checks (code style + tests)
composer check

๐Ÿ“Š Code Coverage

# Run tests with coverage analysis
$env:XDEBUG_MODE="coverage"; composer test-coverage

๐Ÿ“ˆ Current Coverage: 46% overall (23/50 statements)

Component Coverage Status Priority
โœ… Post Model 100% ๐ŸŸข Excellent Maintain
โœ… HasContents Trait 92.9% ๐ŸŸก Very Good Improve
โŒ Content Model 0% ๐Ÿ”ด Critical Add Tests
โŒ PostServiceProvider 0% ๐Ÿ”ด Critical Add Tests

๐Ÿ“‹ Requirements

Requirement Version
PHP ^8.2
Laravel 9.x, 10.x, 11.x
Database MySQL, PostgreSQL, SQLite

๐Ÿ”„ CI/CD

This package uses GitHub Actions for continuous integration and deployment.

๐Ÿงช Continuous Integration

Feature Description
๐Ÿงช Tests Runs on PHP 8.2, 8.3, and 8.4
๐ŸŽจ Code Quality Checks code style using Laravel Pint
๐Ÿ”’ Security Runs security audits on dependencies
๐Ÿ“Š Coverage Generates and uploads coverage reports to Codecov

๐Ÿš€ Automatic Releases

Feature Description
๐Ÿท๏ธ Trigger Pushes to tags (e.g., v1.2.1)
โšก Process Runs tests โ†’ Creates GitHub release โ†’ Publishes to Packagist
๐Ÿ”‘ Requirements Set PACKAGIST_USERNAME and PACKAGIST_TOKEN secrets

๐Ÿ”„ Automated Triggers

  • โœ… Push to master or main branches
  • โœ… Pull requests to master or main branches
  • โœ… Tag pushes (triggers automatic release)

๐Ÿ“Š Code Coverage Status

Component Coverage Status Priority
โœ… Post Model 100% ๐ŸŸข Excellent Maintain
โœ… HasContents Trait 92.9% ๐ŸŸก Very Good Improve
โŒ Content Model 0% ๐Ÿ”ด Critical Add Tests
โŒ PostServiceProvider 0% ๐Ÿ”ด Critical Add Tests

๐Ÿ“ˆ Overall Coverage: 46% (23/50 statements)

๐ŸŽฏ Coverage Goals

Goal Target Status
Target 90%+ overall coverage ๐ŸŽฏ In Progress
Priority Add tests for Content model and PostServiceProvider ๐Ÿ“‹ Planned
Maintenance Keep Post model at 100% coverage โœ… Maintained

๐Ÿ“„ License

This package is open-sourced software licensed under the MIT license.

๐Ÿ†˜ Support

Resource Link
๐Ÿ› Issues GitHub Issues
๐Ÿ“š Documentation Coverage Report
๐Ÿ”„ CI/CD GitHub Actions
๐Ÿ“ฆ Packagist Packagist Package

๐Ÿ“‹ Changelog

๐Ÿš€ v1.2.0 (Latest)

Feature Description
โœจ CI/CD Pipeline Comprehensive GitHub Actions workflow
๐Ÿงช Multi-PHP Testing Runs on PHP 8.2, 8.3, and 8.4
๐ŸŽจ Code Quality Laravel Pint integration
๐Ÿ”’ Security Composer audit integration
๐Ÿ“Š Coverage Xdebug reporting with detailed analysis
๐Ÿ” Authentication Private repository support
๐Ÿ“ฆ Packagist Custom repository support
๐Ÿš€ Auto Release Automatic Packagist publishing on tag push
๐Ÿ“ˆ Reports Detailed coverage analysis
๐Ÿ“š Documentation Comprehensive guides and examples
๐Ÿ”ง Updates Latest GitHub Actions versions

๐Ÿ“ v1.1.0

Feature Description
โœจ Content Management Rich content features
๐Ÿ“ Markdown Support Full markdown conversion
๐Ÿ“Š Analytics Word count and read time calculations

๐ŸŽ‰ v1.0.0

Feature Description
๐ŸŽ‰ Initial Release Basic package foundation
โœจ Post Management Core post functionality
๐Ÿ”— Slug Generation Automatic slug creation
๐Ÿ—‘๏ธ Soft Deletes Safe data deletion