承接 turahe/post 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

turahe/post

最新稳定版本:1.3.1

Composer 安装命令:

composer require turahe/post

包简介

A package for managing posts.

README 文档

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

统计信息

  • 总下载量: 39
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-05