Download the PHP package david-canial/remote-config-tool without Composer

On this page you can find all versions of the php package david-canial/remote-config-tool. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package remote-config-tool

david-canial/remote-config-tool

Firebase Remote Config を操作するための PHP クライアントライブラリです。

シンプルなスクリプト、バッチ処理、既存バックエンドへの組み込みなどに適しています。


インストール

必要環境

Composer でインストールします:


service account と credentials の準備

  1. Google Cloud Console を開きます:

    • 「IAM と管理」→「サービス アカウント」
    • 新しい service account を作成(既存のものを使っても OK)
  2. 権限(ロール)の付与:

    • Firebase Remote Config を操作できるロールを付与します。例:
      • Firebase Remote Config Admin
      • もしくは同等の権限を含むカスタムロール
  3. JSON キーを作成:

    • service account 詳細画面 → 「キー」タブ → 「キーを追加」→「新しいキーを作成」→ JSON
    • ダウンロードした JSON ファイルを、例えば /path/to/service-account.json に保存
  4. Google 認証用の環境変数を設定:

  5. FIREBASE_PROJECT_ID を設定:

your-firebase-project-id は、JSON ファイル内の projectId か、Firebase コンソールのプロジェクト ID に対応します。

Laravel や Symfony などのフレームワークを利用している場合は、これらの値を .env に定義し、フレームワーク側で読み込ませても構いません。


静的ファサード RemoteConfig を使った簡単な利用例

インストールと環境変数の設定が完了したら、RemoteConfig ファサードを利用できます:

環境変数 FIREBASE_PROJECT_ID を使わず、明示的に projectId を指定することもできます:


ETag を使った Remote Config の更新

Firebase Remote Config では、他の更新を誤って上書きしないように、更新時に ETag を送信することが推奨されています。

parameters を一部変更する例:

もし ETag が古い場合(他のクライアントが先に更新していた場合など)、Firebase は HTTP 412 (Precondition Failed) を返します。その場合は:


Force update(ETag を無視して上書き)

状況によっては、ETag チェックを無視して常に現在の設定を上書きしたい 場合もあります:

注意: forceUpdate は他のクライアントによる変更を上書きする可能性があります。同時更新があり得る環境では慎重に使用してください。


RemoteConfigClient を直接利用する

より細かく制御したい場合や、独自の Guzzle クライアントを注入したい場合は、RemoteConfigClient クラスを直接利用できます:


.env を使った設定読み込み(任意)

このライブラリは、vlucas/phpdotenv を利用して .env を読み込み、 その上で RemoteConfigClient インスタンスを生成するヘルパーも提供しています:

createFromEnvFile($directory, $file = '.env') は次のことを行います:


エラー処理

よくあるエラーとその原因:

基本的なエラーハンドリング例:


ライセンス

このパッケージは MIT ライセンス のもとで提供されます。商用・個人プロジェクトを問わず自由に利用できます。

remote-config-tool

remote-config-tool

remote-config-tool


All versions of remote-config-tool with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
firebase/php-jwt Version ^6.10
google/auth Version ^1.40
guzzlehttp/guzzle Version ^7.8
vlucas/phpdotenv Version ^5.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package david-canial/remote-config-tool contains the following files

Loading the files please wait ...