pittacusw/core
Composer 安装命令:
composer require pittacusw/core
包简介
Core modifications for laravel
README 文档
README
Shared Laravel package for Pittacusw projects.
This package currently provides:
- a default GitHub webhook endpoint at
/api/github - a queued deployment job that runs
git pullandcomposer install - safe, configurable security headers middleware
RememberTraitfor model query caching with automatic cache invalidation- artisan helpers for
git:add,git:pull, andcomposer:install - package translations
Compatibility
- PHP:
^8.2 - Laravel:
^9.26|^10.0|^11.0|^12.0|^13.0
The runtime package keeps Laravel compatibility in its own constraints. For package tests, use the matching orchestra/testbench major for the Laravel version under test.
Installation
composer require pittacusw/core
Publish the package config if you want to override the defaults:
php artisan vendor:publish --tag="pittacusw-core-config"
If you use the GitHub webhook endpoint, you must also configure the webhook secret in the host application:
GITHUB_WEBHOOK_SECRET=your-webhook-secret
Configuration
The package config file is config/pittacusw-core.php.
Deployment
These settings control the queued push webhook handler:
PITTACUSW_CORE_DEPLOYMENT_ENABLEDPITTACUSW_CORE_DEPLOYMENT_LOCK_SECONDSPITTACUSW_CORE_DEPLOYMENT_RETRY_DELAY_SECONDS
Behavior:
- the package registers
Pittacusw\Core\Jobs\HandlePushWebhookas the defaultpushjob only whengithub-webhooks.jobs.pushis not already defined by the host app - deployment runs under a cache lock to prevent overlapping
git pullandcomposer installexecutions - command failures throw, so the queue worker marks the job as failed instead of silently continuing
Security Headers
These settings control the global middleware registered by the package:
PITTACUSW_CORE_SECURITY_HEADERS_ENABLEDPITTACUSW_CORE_SECURITY_HEADERS_FRAME_OPTIONSPITTACUSW_CORE_SECURITY_HEADERS_REFERRER_POLICYPITTACUSW_CORE_SECURITY_HEADERS_HSTS_ENABLEDPITTACUSW_CORE_SECURITY_HEADERS_HSTS_MAX_AGEPITTACUSW_CORE_SECURITY_HEADERS_HSTS_INCLUDE_SUBDOMAINSPITTACUSW_CORE_SECURITY_HEADERS_HSTS_PRELOAD
Default headers:
X-Content-Type-Options: nosniffX-Frame-Options: DENYReferrer-Policy: no-referrerStrict-Transport-Securityon secure requests only
The middleware intentionally does not emit deprecated headers such as X-XSS-Protection or Public-Key-Pins-Report-Only.
GitHub Webhooks
The package registers:
POST /api/github
This route points to Spatie's GitHub webhook controller. The route is always available when the package service provider is loaded.
Important notes:
- signature validation is handled by
spatie/laravel-github-webhooks - the host application still owns the authoritative
github-webhooksconfig - if you need a custom
pushjob, definegithub-webhooks.jobs.pushin the host app and the package will not override it - the webhook route does not publish or own the Spatie migration anymore; the webhook storage table should come from
spatie/laravel-github-webhooks
RememberTrait
RememberTrait adds model-wide query caching and cache invalidation.
Example:
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Pittacusw\Core\Traits\RememberTrait; class Country extends Model { use RememberTrait; }
Defaults:
- caches model queries for
31536000seconds - uses a model-specific cache prefix
- uses cache tags when the current cache store supports them
- flushes cached queries after
saved,deleted, andrestoredevents
Optional model properties:
$rememberFor$rememberCachePrefix$rememberCacheTag$rememberCacheDriver
Console Commands
The package exposes:
php artisan git:add {message?}php artisan git:pullphp artisan composer:install
These commands execute external processes through Symfony Process instead of shell-constructed exec() strings.
Testing
The package now includes package-owned PHPUnit coverage for:
- route registration and webhook wiring
- service-provider config behavior
- safe security headers
RememberTraitcache invalidation- external process command dispatch
- deployment locking and failure behavior
Run the package tests from the package root:
composer install
composer test
Upgrade Notes
Recent internal hardening changed a few package details while preserving the public behavior used by existing projects:
- webhook migration ownership moved back to
spatie/laravel-github-webhooks RememberTraitno longer depends onwatson/rememberable- deployment commands now fail loudly instead of silently swallowing command errors
- security headers are response-based and configurable
pittacusw/core 适用场景与选型建议
pittacusw/core 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 219 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 08 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「artisan」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 pittacusw/core 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pittacusw/core 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 pittacusw/core 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Collection of handy Laravel artisan commands that most projects needs
Additional artisan commands for Laravel
Enterprise-Grade Modular Architecture for Laravel Applications - A powerful Laravel package that revolutionizes application development with robust Service Repository Pattern, Dynamic Module Management, and 50+ Artisan commands for scalable, maintainable applications.
Create views, including "resource" views, using console commands.
Generates Laravel Migrations from an existing database
Laravel Craftsman
统计信息
- 总下载量: 219
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2022-08-13