承接 pittacusw/core 相关项目开发

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

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

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 pull and composer install
  • safe, configurable security headers middleware
  • RememberTrait for model query caching with automatic cache invalidation
  • artisan helpers for git:add, git:pull, and composer: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_ENABLED
  • PITTACUSW_CORE_DEPLOYMENT_LOCK_SECONDS
  • PITTACUSW_CORE_DEPLOYMENT_RETRY_DELAY_SECONDS

Behavior:

  • the package registers Pittacusw\Core\Jobs\HandlePushWebhook as the default push job only when github-webhooks.jobs.push is not already defined by the host app
  • deployment runs under a cache lock to prevent overlapping git pull and composer install executions
  • 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_ENABLED
  • PITTACUSW_CORE_SECURITY_HEADERS_FRAME_OPTIONS
  • PITTACUSW_CORE_SECURITY_HEADERS_REFERRER_POLICY
  • PITTACUSW_CORE_SECURITY_HEADERS_HSTS_ENABLED
  • PITTACUSW_CORE_SECURITY_HEADERS_HSTS_MAX_AGE
  • PITTACUSW_CORE_SECURITY_HEADERS_HSTS_INCLUDE_SUBDOMAINS
  • PITTACUSW_CORE_SECURITY_HEADERS_HSTS_PRELOAD

Default headers:

  • X-Content-Type-Options: nosniff
  • X-Frame-Options: DENY
  • Referrer-Policy: no-referrer
  • Strict-Transport-Security on 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-webhooks config
  • if you need a custom push job, define github-webhooks.jobs.push in 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 31536000 seconds
  • uses a model-specific cache prefix
  • uses cache tags when the current cache store supports them
  • flushes cached queries after saved, deleted, and restored events

Optional model properties:

  • $rememberFor
  • $rememberCachePrefix
  • $rememberCacheTag
  • $rememberCacheDriver

Console Commands

The package exposes:

  • php artisan git:add {message?}
  • php artisan git:pull
  • php 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
  • RememberTrait cache 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
  • RememberTrait no longer depends on watson/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 我们能提供哪些服务?
定制开发 / 二次开发

基于 pittacusw/core 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-08-13