PHPackages                             ndj888/com\_jjcbs\_tool - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ndj888/com\_jjcbs\_tool

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ndj888/com\_jjcbs\_tool
=======================

Publish package about jjcbs use some class file on working!

v1.20(6y ago)91792MITPHPPHP ^7.0CI failing

Since Sep 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ndj888/com_jjcbs_tool)[ Packagist](https://packagist.org/packages/ndj888/com_jjcbs_tool)[ RSS](/packages/ndj888-com-jjcbs-tool/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (10)Dependencies (2)Versions (22)Used By (2)

简介：
---

[](#简介)

个人常用工具类封装phar包

Vesion
------

[](#vesion)

The Project release version v0.1.

### use composer

[](#use-composer)

composer require ndj888/com\_jjcbs\_tool

注解
==

[](#注解)

为了提高编程效率，开始采用注解模式，解决注入POPO解耦。

\#使用注解 ###注解方法： 定义注解需实现于com\_jjcbs\\lib\\AnnotationMethodAbstract，例： ex;

```
    namespace com_jjcbs\lib\annotation;

    use com_jjcbs\exceptions\AnnotationException;
    use com_jjcbs\fun\AnnotationFun;
    use com_jjcbs\lib\AnnotationMethodAbstract;

    /**
     * format of type json serialize
     * Class OutPutFormat
     * @package com_jjcbs\lib\annotation
     */
    class OutPutFormat extends AnnotationMethodAbstract
    {
        static protected function parsedMethod($data = null)
        {
            // TODO: Implement parsedMethod() method.
            self::parseMethodExec($data);
        }

        static protected function parsedClass($data = null)
        {
            // TODO: Implement parsedClass() method.
            return 'disable';
        }

        static protected function parsedVar($data = null)
        {
            // TODO: Implement parsedVar() method.
            $getterStr = AnnotationFun::createGetterByVar(self::$argv['varName'] , $data);
            self::$input = str_replace('//{{annotation placeholder}}' , $getterStr , self::$input);
        }

        static protected function do()
        {
            // TODO: Implement do() method.
            switch (self::$param['type']){
                case 'json':
                    if(isset(self::$argv['varName'])) return sprintf('return json_decode($this->%s , true);' , self::$argv['varName']);
                    if(isset(self::$argv['methodName'])) return 'return json_decode(%s , true)';
                    break;
                default:break;

            }
        }

        static protected function exception(AnnotationException $exception)
        {
            // TODO: Implement exception() method.
            // no thing
            return ;
        }

    }

```

\###使用注解

```

    /**
     * @@OutPutFormat(type="json")
     * @return array
     */
    public function getJson(){
        return $this->getArr();
    }

```

所有注解推荐定义以@@注释开始，如@@OutPutFormat()

### 注解的作用范围

[](#注解的作用范围)

1. 作用于成员变量的注解

    ```
            /**
             * @@com_jjcbs\lib\annotation\OutPutFormat(type="json")
             * @var string
             */
            private $type = '123';

    ```
2. 作用于成员方法的注解

    ```
    /**
     * @@OutPutFormat(type="json")
     * @return array
     */
    public function getJson(){
        return $this->getArr();
    }

    ```
3. 作用于类的注解

```
/**
 * @@Service()
 * Class TestServiceAnnotation
 * @package com_jjcbs\test\resource\scan
 */
class TestServiceAnnotation
{
    public function testGetInfo(){
        return 'hellow world';
    }
}

```

### 编译注解

[](#编译注解)

推荐自行实现编译小工具 ex:

```
// 创建以文件试编译注解驱动
$annotationFileCacheDriver = new \com_jjcbs\lib\drivers\AnnotationFileCacheDriverImpl();
//获取配置单例，设置配置
$annotationConfig = \com_jjcbs\lib\ServiceFactory::getInstance(\com_jjcbs\service\AnnotationConfigServiceImpl::class);
\com_jjcbs\lib\conf\AnnotationConfig::setData([
    // the alias map
    // 设置别名映射，方便使用短名称，否则需要使用命名空间全名注解方法
    'alias' => [
        'Service' => Service::class,
        'Rpc' => Rpc::class,
        'OutPutFormat' => OutPutFormat::class
    ],
    // These annotations will be scanning
    // 所有composer psr-4定义的autoload命名空间将被扫描
    // These annotations will be scanning
    'scanNamespace' => [
        "com_jjcbs\\" => "src/com_jjcbs/"
    ],
    // 项目根目录
    'appPath' => COM_JJCBS_ROOT_PATH,
    // build 目录注意 /
    'buildPath' => COM_JJCBS_ROOT_PATH . '/build/'
]);
    // 扫描编译注解
$annotationFileCacheDriver->scanNamespacesFiles();

```

编译成完得到build目录，替换原有composer命名空间即可工作。

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 91.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~47 days

Recently: every ~146 days

Total

20

Last Release

2325d ago

Major Versions

v0.16 → v1.02017-11-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/fabd7b3471d76b62c48f22bdf3557e050d628b99e06a3b8115356d9e40731c82?d=identicon)[ndj888](/maintainers/ndj888)

---

Top Contributors

[![ndj888](https://avatars.githubusercontent.com/u/11382964?v=4)](https://github.com/ndj888 "ndj888 (21 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

com\_jjcbsmytool

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ndj888-com-jjcbs-tool/health.svg)

```
[![Health](https://phpackages.com/badges/ndj888-com-jjcbs-tool/health.svg)](https://phpackages.com/packages/ndj888-com-jjcbs-tool)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
