npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

px2agent

v3.0.0

Published

Pickles 2 と NodeJS スクリプトを仲介するAPIを提供します。

Readme

px2agent

px2agent は、Pickles 2 と NodeJS スクリプトを仲介するAPIを提供します。

NPM

使い方 - Usage

CommonJS (JavaScript)

// CommonJS形式
const px2agent = require('px2agent');
const px2proj = px2agent.createProject('./.px_execute.php');

// コールバックスタイル(従来のAPI)
px2proj.get_version(function(version) {
  console.log('Pickles 2 バージョン: ', version);
});

// Promiseスタイル(新しいAPI)
px2proj.get_version()
  .then(version => {
    console.log('Pickles 2 バージョン: ', version);
  })
  .catch(err => {
    console.error('エラー: ', err);
  });

// async/awaitスタイル(新しいAPI)
async function checkVersion() {
  try {
    const version = await px2proj.get_version();
    console.log('Pickles 2 バージョン: ', version);
  } catch (err) {
    console.error('エラー: ', err);
  }
}
checkVersion();

ES Modules (TypeScript/JavaScript)

// ESモジュール形式(TypeScript/JavaScript)
import px2agent from 'px2agent';
// または
import { px2agent } from 'px2agent';

// プロジェクトを初期化
const px2proj = px2agent.createProject('./.px_execute.php');

// async/await を使った例
async function main() {
  try {
    // バージョンを取得
    const version = await px2proj.get_version();
    console.log('Pickles 2 バージョン: ', version);
    
    // 設定を取得
    const config = await px2proj.get_config();
    console.log('設定: ', config);
    
    // サイトマップを取得
    const sitemap = await px2proj.get_sitemap();
    console.log('サイトマップ: ', sitemap);
    
    // ページ情報を取得
    const pageInfo = await px2proj.get_page_info('/');
    console.log('ページ情報: ', pageInfo);
    
    // パブリッシュを実行
    const publishResult = await px2proj.publish({
      path_region: '/path/to/publish/'
    });
    console.log('パブリッシュ結果: ', publishResult);
  } catch (err) {
    console.error('エラー: ', err);
  }
}

main();

TypeScript での型定義の利用

import px2agent from 'px2agent';
import { Px2ProjectOptions, PublishOptions } from 'px2agent';

// オプションを型付きで定義
const options: Px2ProjectOptions = {
  bin: '/path/to/php',
  ini: '/path/to/php.ini',
  extension_dir: '/path/to/ext/'
};

// プロジェクトを初期化
const px2proj = px2agent.createProject('./.px_execute.php', options);

// 型付きの公開オプション
const publishOptions: PublishOptions = {
  path_region: '/path/region/',
  paths_region: [
    '/path/region1/',
    '/path/region2/'
  ],
  paths_ignore: [
    '/path/region/ignored/1/',
    '/path/region/ignored/2/'
  ],
  keep_cache: true
};

// パブリッシュを実行
async function publishProject() {
  try {
    const result = await px2proj.publish(publishOptions);
    console.log('パブリッシュ結果: ', result);
  } catch (err) {
    console.error('エラー: ', err);
  }
}

PHPバイナリのパスを指定する場合 - Specifying path to PHP binary

var px2proj = require('px2agent').createProject(
  './px_execute.php',
  {
	'bin': '/path/to/php',
	'ini': '/path/to/php.ini',
	'extension_dir': '/path/to/ext/'
  }
);

開発者向け情報 - for developers

開発環境セットアップ - Setting up development environment

$ cd {$project_root}
$ composer install
$ npm install

ビルド - Build

$ npm run build

テスト - Test

$ npm test

ドキュメント出力 - Documentation

$ npm run documentation

更新履歴 - Change log

px2agent v3.0.0 (2025年5月5日)

  • コールバックベースAPIからPromise/async-awaitベースAPIへの変更
  • CommonJSモジュールとESモジュール両方のサポート
  • TypeScriptへ移行、型定義ファイル(.d.ts)の提供

px2agent v2.0.7 (2021年1月16日)

  • pj.query() に、新しいオプション methodbodybodyFile を追加。

px2agent v2.0.6 (2019年8月12日)

  • pj.px_command() を追加。

px2agent v2.0.5 (2017年3月14日)

  • pickles2/[email protected] 対応
  • pj.publish()keep_cache オプションを追加。
  • pj.publish()paths_region オプションを追加。
  • pj.get_path_homedir()pj.get_realpath_homedir() に改名。(古いメソッド名の実装は残されているが非推奨)
  • pj.get_path_docroot()pj.get_realpath_docroot() に改名。(古いメソッド名の実装は残されているが非推奨)

px2agent v2.0.4 (2016年2月22日)

  • pickles2/[email protected] 対応
  • pj.publish()paths_ignore オプションを追加。

px2agent v2.0.3 (2015年11月9日)

  • pickles2/[email protected] 対応
  • アクター機能 pj.get_role(), pj.get_actors() を追加。

px2agent v2.0.2 (2015年9月15日)

  • PHPが異常終了した場合の例外をキャッチし、 false を返すようになった。

px2agent v2.0.1 (2015年9月10日)

  • PHPのパスを指定した場合の引数 -c-d に関する不具合を修正。
  • オプション extension_dir を追加。

px2agent v2.0.0 (2015年6月28日)

  • Initial Release.

ライセンス - License

MIT License

作者 - Author