yhshanto/larapress 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

yhshanto/larapress

Composer 安装命令:

composer require yhshanto/larapress

包简介

Wordpress Plugin Boilerplate in laravel 5.5.* flavour.

README 文档

README

Requirements

  • PHP >=7.0
  • WORDPRESS >= 4.x.x

Installation

composer create-project yhshanto/larapress plugin-name

After install larapress project open plugin-name.php file and edit following as your need.

/*
 * Plugin Name:       Your Plugin name
 * Plugin URI:        your-plugin-url
 * Description:       This is a short description
 * Version:           1.0.0
 * Author:            Plugin Author
 * Author URI:        Author Url
 * License:           GPL-2.0+
 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
 * Text Domain:       Text Domain
*/

Usage

Database

To Use Wordpress Database like Laravel Eloquent Style, First Create A class in plugin directory which extend Illuminate\Database\Eloquent\Model Class.

Example plugin/Post.php

<?php
namespace Plugin;

use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    //
}

You Can Use It Like Plugin\Post::all() Which return all post from wordpress database.

To learn More about Laravel Eloquent. Go To Doc

Blade View

LaraPress also include Laravel Blade Template Engine To Compile And Render View.

All view file must be store in resources/views folder.

Example: resources/views/welcome.blade.php

<h1>
    {{ $heading }}
</h1>
<p>
    {!! $description !!}
</p>

You Can Use This View By view( $view, $data = array(), $return = false ) function.

Example: Echo This View

$data['heading'] = 'Larapress';
$data['description'] = 'Write Something Here';

view('welcome', $data);

Or To return

$data['heading'] = 'Larapress';
$data['description'] = 'Write Something Here';

$view = view('welcome', $data, true);

To learn More about Laravel Blade Template Engine. Go To Doc

Wordpress Action Hook

Wordpress makes life easier by its hooking functionality. LaraPress brings a more easier and formatted way to working with wordpress action and filter hook.

In Larapress you can create special Hook class that uses for hooking.

All hooks class must be store in plugin/Hooks folder.

A Hook Example: plugin/Hooks/Auto.php

<?php
namespace Plugin\Hooks;

class Auto extends Hook
{
	
	function boot()
	{

		$this->loader->add_filter('the_title', 'title');

	}

	function title($title)

	{

		return 'LaraPress';

	}
}

After Creating A New Hook class You Must Add it with $hooks array which located in config/plugin.php

Example: config/plugin.php $hooks Array

$hooks = array(
	'Auto'
);

The $loader property of all hook class is a object of Plugin\Lpress\Loader Class. Which have two function for hooking. Functions -

add_action( $hook, $callback, $priority = 10, $accepted_args = 1 )
add_filter( $hook, $callback, $priority = 10, $accepted_args = 1 )

yhshanto/larapress 适用场景与选型建议

yhshanto/larapress 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17 次下载、GitHub Stars 达 2, 最近一次更新时间为 2018 年 02 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 yhshanto/larapress 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-02-26