GithubHelp home page GithubHelp logo

minbaby / php-ext-startup Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 3.0 295 KB

php-ext-startup php-extension startup

Home Page: https://minbaby.github.io

License: MIT License

M4 0.89% JavaScript 0.11% C 39.55% PHP 38.28% Shell 21.01% Makefile 0.16%
extension startup php kahlan

php-ext-startup's Introduction

学习 php 扩展

CircleCI xcxc codecov

基本思路

  1. 先写测试用例
  2. 再用 php 实现
  3. 再用 ext 实现
  4. 跑测试

测试思路

利用 php 自动加载的逻辑。

  1. 默认禁用扩展执行一遍测试,这个时候执行的是 PHP 逻辑
  2. 启用扩展再执行一次扩展, 这个时候执行的是 EXT 逻辑 (这个地方有个问题,如果 ext 扩展不存在,那么就会降级使用 php 代码)

使用函数动态生成对应的�带有命名空间的类名,原因是之前的思路存在漏洞,�因为自动加载的存在,导致如果 ext 中不存在,就会自动降级为 php 代码。

学习方式

如果我们需要查看这个项目,那么思路是什么的?

  1. 先看 spec/ 这些文件的测试用例。
  2. 查看 src/Minbaby/ 目录下的 php 实现
  3. 查看 src/ext 目录下的 c 实现

常用命令

  1. 测试所有
composer run test
# or
make ext-first
  1. 测试 php 部分代码
composer run test-php
# or
make ext-test
  1. 测试 ext 部分代码
composer run test-ext
# or
make ext-test-ext
  1. 其他命令
make ext-clean # clean code

make ext-fetch # fetch configure ext code from github

make ext-prepare # phpize & configure

make ext-buidl

TODO

说明

  • 本项目只是学习实践使用
  • 使用 @ 抑制符不是一个好习惯,尽量不要使用。
  • 依赖 mb_string 扩展

已知问题

skip ci

  • [skip ci]
  • [ci skip]

参考

php-ext-startup's People

Contributors

minbaby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

php-ext-startup's Issues

Stringy

  • __construct

  • create

  • __toString

  • append

  • at

  • between

  • camelize

  • chars

  • contains

  • containsAll

  • containsAny

  • count

  • countSubstr

  • dasherize

  • delimit

  • endsWith

  • endsWithAny

  • ensureLeft

  • ensureRight

  • first

  • getEncoding

  • getIterator

  • hasLowerCase

  • hasUpperCase

  • htmlDecode

  • htmlEncode

  • humanize

  • indexOf

  • indexOfLast

  • insert

  • isAlpha

  • isAlphanumeric

  • isBlank

  • isHexadecimal

  • isJson

  • isLowerCase

  • isSerialized

  • isBase64

  • isUpperCase

  • last

  • length

  • lines

  • longestCommonPrefix

  • longestCommonSuffix

  • longestCommonSubstring

  • lowerCaseFirst

  • offsetExists

  • offsetGet

  • offsetSet

  • offsetUnset

  • pad

  • padBoth

  • padLeft

  • prepend

  • regexReplace

  • removeLeft

  • removeRight

  • repeat

  • replace

  • reverse

  • safeTruncate

  • shuffle

  • slugify

  • startsWith

  • startsWithAny

  • slice

  • split

  • stripWhitespace

  • substr

  • surround

  • swapCase

  • tidy

  • titleize

  • toAscii

  • toBoolean

  • toLowerCase

  • toSpaces

  • toTabs

  • toTitleCase

  • toUpperCase

  • trim

  • trimLeft

  • trimRight

  • truncate

  • underscored

  • upperCaseFirst

  • charsArray

  • langSpecificCharsArray

  • applyPadding

  • matchesPattern

  • eregReplace

  • regexEncoding

  • supportsEncoding

文档部分

  • 使用 circleci 本地测试
  • 搭建基础开发环境 phpbrew
  • 使用vscode

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.