定制 imranhsayed/headless-cms 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

imranhsayed/headless-cms

Composer 安装命令:

composer require imranhsayed/headless-cms

包简介

A WordPress plugin that adds features to use WordPress as a headless CMS with any front-end environment using REST API

README 文档

README

Project Status: Active.

A WordPress plugin that adds features to use WordPress as a headless CMS with any front-end environment using REST API. This plugin provides multiple features and you can use the one's that are relevant to your front-end application. You don't necessarily need to use all.

Headless CMS WordPress Plugin

Install via Composer

composer require imranhsayed/headless-cms

Maintainer

Name Github Username
Imran Sayed @imranhsayed

Assets

Assets folder contains webpack setup and can be used for creating blocks or adding any other custom scripts like javascript for admin.

  • Run npm i from assets folder to install required npm packages.
  • Use npm run dev during development for assets.
  • Use npm run prod for production.
  • Use npm run eslint:fix js/fileName.js for fixing and linting eslint errors and warning.

REST API ENDPOINT

This plugin provides you different endpoints using WordPress REST API.

Getting Started 📋

These instructions will get you a copy of the project up and running on your local machine for development purposes.

Prerequisites 🚪

You need to have any WordPress theme activated on your WordPress project, which has REST API enabled.

Installation 🔧

  1. Clone the plugin directory in the /wp-content/plugins/ directory, or install a zipped directory of this plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the 'Plugins' screen in WordPress

Example Frontend applications

Example of front-end applications where this plugin can be used:

  1. Gatsby WordPress Theme
  2. React Wordpress Theme

Features

  1. Custom REST API Endpoints.
  2. Social links in customizer.
  3. Image uploads for categories.
  4. Custom header and footer menus.
  5. Custom Widgets.
  6. Custom Header and Footer GraphQL fields when using wp-graphql plugin
  7. Adds coAuthors data in the GraphQL Api.
  • Adds option to add social links in customizer
  • Registers two custom menus for header ( menu location = hcms-menu-header ) and for footer ( menu location = hcms-menu-footer )
  • Registers the following sidebars
  1. HCMS Footer #1 with sidebar id 'hcms-sidebar-1'

  1. HCMS Footer #2 with sidebar id 'hcms-sidebar-2'

More Features

  1. Registers the sections for socials icons in the customizer
  • Social icons urls for 'facebook', 'twitter', 'instagram', 'youtube'

  1. Image upload features for categories
  • Provides Image upload features for categories.

  1. Plugin Settings Page
  • Settings for getting data for a custom page like Hero section, Search section, Featured post section, latest posts heading.

  • Registers custom end points

  1. Following fields when using wp-graphql plugin.
  • Custom Header and Footer GraphQL

  • WooCommerce Countries and States

{
  wooCountries {
    billingCountries {
      countryCode
      countryName
    }
    shippingCountries {
      countryCode
      countryName
    }
  }
  wooStates(countryCode: "in") {
    states {
      stateCode
      stateName
    }
  }
}
  • WooCommerce Shipping Zones.
{
  shippingInfo {
    shippingZones
    storePostCode
  }
}
  • Add Product to Wishlist Mutation ( Authenticated request )
mutation ADD_ITEM {
  addToWishlist(input: {clientMutationId: "example", productId: 340}) {
    clientMutationId
    error
    added
    productId
    wishlistProductIds
  }
}
  • Remove Product from Wishlist Mutation( Authenticated request )
mutation REMOVE_ITEM{
  removeFromWishlist(input: {clientMutationId: "example", productId: 340}) {
    error
    productId
    removed
    wishlistProductIds
  }
}
  • Get Products from Wishlist Mutation ( Authenticated request )
query GET_WISHLIST {
  getWishList {
    productIds
    error
    products {
      databaseId
      name
      slug
      buttonText
      image {
        alt
        src
        attachmentId
      }
      priceHtml
      productUrl
      stockQuantity
      stockStatus
      typename
    }
  }
}
  • Schema Details
  posts {
    nodes {
      seo {
        schemaDetails
      }
    }
  }

Available Endpoints:

Get single post ( GET request )

  • http://example.com/wp-json/rae/v1/post?post_id=1

Get posts by page no: ( GET Request )

  • http://example.com/wp-json/rae/v1/posts?page_no=1

Get header and footer date: ( GET Request )

  • Get the header data ( site title, site description , site logo URL, menu items ) and footer data ( footer menu items, social icons )
  • http://example.com/wp-json/rae/v1/header-footer?header_location_id=hcms-menu-header&footer_location_id=hcms-menu-footer

Get WooCommerce Country and states ( GET Request )

  • /wp-json/rae/v1/wc/countries/
  • /wp-json/rae/v1/wc/states?countryCode=IN

Contributing 👥

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

I use Git for versioning.

Author 📝

License 📜

License: GPL v2

imranhsayed/headless-cms 适用场景与选型建议

imranhsayed/headless-cms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.08k 次下载、GitHub Stars 达 212, 最近一次更新时间为 2020 年 09 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「plugin」 「wordpress」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 imranhsayed/headless-cms 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 imranhsayed/headless-cms 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 212
  • Watchers: 11
  • Forks: 33
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2020-09-12