PHPackages                             strangerwork/strangerwas - 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. strangerwork/strangerwas

ActiveProject

strangerwork/strangerwas
========================

0.9.0(6y ago)010MITSmarty

Since Apr 5Pushed 11mo agoCompare

[ Source](https://github.com/satokadumasa/strangerwas)[ Packagist](https://packagist.org/packages/strangerwork/strangerwas)[ Docs](https://september-rain.com/)[ RSS](/packages/strangerwork-strangerwas/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

StrangerPHP
===========

[](#strangerphp)

StrangerPHPはPHPで動くWebFrameworkです.

Create new project
==================

[](#create-new-project)

新しいプロジェクトを開始するには、下記のようにしてStrangerPHPをcloneしてください。 下記の例では、/home/someone/Project配下にプロジェクト名「stranger」でプロジェクトを作成します。 $&amp;gt; cd /home/someone/Project/ $&amp;gt; git clone  stranger

データベースの作成
=========

[](#データベースの作成)

StrangerPHPはデータベースとしてMySQLを使用します。 データベース上にスキーマを作成し、スキーマにテーブルを作成してそこにデータの読み書きをするのです。 まず、データベース上にスキーマを作成しましょう。

最初にやることは、データベースの初期化です。初期化により、スキーマを生成します。 まず、データベース接続情報を記述したdatabase.config.phpを作成します。 というか、sampleをコピーします。このとき、すでにプロジェクトを作成した/home/someone/Project/ ディレクトリに いるものとします。

$&amp;gt; cd stranger $&amp;gt; cp config/database.config.sample.php config/development/ $&amp;gt; cp config/database.config.sample.php config/staging/ $&amp;gt; cp config/database.config.sample.php config/production/ $&gt; cp config/database.config.sample.php config/test/

次にスキーマの生成です。以下の条件でスキーマを生成するものとします。

HOST:localhost Charset:utf8 user:root password:password スキーマ名:stranger

まず、先ほどコピーして作成したdatabase.config.phpを以下のように編集します。 $&gt; vi config/\[ENVIRONMENT\]/database.config.php

$default\_database = array( 'rdb' =&gt; 'mysql', 'host' =&gt; 'localhost', 'dbname' =&gt; 'mysql', 'charset' =&gt; 'utf8', 'username' =&gt; 'root', 'password' =&gt; 'password', );

この時点ではスキーマ名(dbname)を自分のプロジェクト用のスキーマ名には変更しないでください。 編集がおわったらdatabase.config.phpを保存して編集を終了してください。

次に下記のコマンドを実行してください。

$&gt; php ./stranger.php migrate:create:schema localhost:utf8:root:password:stranger

これで、MySQL上にスキーマ名「stranger」でスキーマが作成されました。

次に、migration管理テーブルであるmigrationsをstrangerスキーマ上に作成します。 下記のコマンドを実行してください。

$&gt; php ./stranger.php migrate:init

これで、スキーマ、migration管理テーブルが作成されてました。次に、再度database.config.php を編集してスキーマ名を変更します。

$&gt; vi config/\[ENVIRONMENT\]/database.config.php

$default\_database = array( 'rdb' =&gt; 'mysql', 'host' =&gt; 'localhost', 'dbname' =&gt; 'stranger', 'charset' =&gt; 'utf8', 'username' =&gt; 'root', 'password' =&gt; 'password', );

これで、スキーマstrangerにアクセスできるようになりました。

Create scaffold
===============

[](#create-scaffold)

StrangerPHPは軽量ではありますが、強力なフレームワークです。 その力の一つがscaffold機能です。 Ruby on Railsなどを使ったことのある方ならおなじみの機能ですね。 コマンド一発で、コントローラーからモデルから、migrationファイルからCRUD機能の実現に必要な 実装の骨組みを生成してくれる機能です。では、そのscaffold機能を使ってuser\_infosテーブルに読み書き をしてviewに読み書きした内容を表示するUserInfoControllerとviewファイル一式、そしてuser\_infosテーブル を作成するためのmigrationファイルを作成してみましょう。

生成する内容としては下記の通りです。 id:識別番号 first\_name:名 last\_name:姓 pref\_id:都道府県ID city:市区町村名 address:町名・番地

下記のコマンドをプロジェクトルートディレクトリ/home/someone/Project/stranger/で実行してください。

$&gt; php ./stranger.php -g scaffold user\_infos
first\_name:string:64:false::
last\_name:string:64:false::
pref\_id:int:8:false::
city:string:32:false::
address:string:64:false:: \\

言うまでもないかと思いますが 「\\」は改行をしめすものではなく続きがあることを示す記号です。 実際には（「\\」を抜いて）一行で入力してください。

すると、下記のファイルが出来上がります。

コントローラ /home/someone/Project/stranger/controllers/UserInfoController.php モデルクラス /home/someone/Project/stranger/models/UserInfo.php Viewテンプレート /home/someone/Project/stranger/views/UserInfo/index.tpl /home/someone/Project/stranger/views/UserInfo/create.tpl /home/someone/Project/stranger/views/UserInfo/edit.tpl /home/someone/Project/stranger/views/UserInfo/show.tpl Migrationファイル /home/someone/Project/stranger/db/migrate/20170531235959CreateTableUserInfo.php

これで、とりあえずuser\_infosテーブルへの読み書きと読み込み結果の表示を行う機能の骨組みは出来上がりました。

Run Migration
=============

[](#run-migration)

スキーマstranger内をMySQLのクライアントソフトで覗き見るとわかるかと思いますが、 この時点ではまだmigration管理用のmigrationsテーブルしかありません。 Scaffoldで作った機能で読み書きする対象テーブルuser\_infosを作成しないと機能は動きません。 テーブル作成のためには下記のコマンドを実行してください。

$&gt; php ./stranger.php migrate

そうすると、user\_infosテーブルが作成されます。

以上で、プロジェクト作成とScaffold、migration機能についての説明は終了です。

なお、StrangerPHPについてのサポートは随時受け付けております。 商用利用、業務プロジェクトでの利用についてはサポートは有料とさせていただいております。 それ以外、個人での非営利プロジェクトでの利用でのサポートをいたします。 お気軽に下記のメールアドレスまでお問い合わせください。

email: sato.kadumasa＠gmail.com

StrangerPHP
===========

[](#strangerphp-1)

Currently, only the following functions can be used.

1. Scaffold You can create a controller, model, View template file.
2. Generate controller You can create controller &amp; method, View template file.
3. Generate model class You can create model classes. A simple example of use is described below.
4. Run migration

scaffold
========

[](#scaffold)

By using the Scaffold function, you can create a controller, model, and view template with CRUD function at once.

ex) $&gt; php ./stranger.php -g scaffold books name:string outline:text detail:text

generate controller
===================

[](#generate-controller)

If you create only the controller, execute the stranger command as shown. The controller and the view template file are created.

ex) $&gt; php ./stranger.php -g controller books index show create delete

generate model
==============

[](#generate-model)

If you create only the model class file, execute the stranger command as shown below.

ex) $&gt; php ./stranger.php -g model books name:string outline:text detail:text

Migration
=========

[](#migration)

A migration file is created by Scaffold or model creation. You can create tables on the database using this migration file.

ex) $&gt; php ./stranger.php migrate

###  Health Score

27

↑

LowBetter than 49% of packages

Maintenance40

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2225d ago

### Community

Maintainers

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

---

Top Contributors

[![satokadumasa](https://avatars.githubusercontent.com/u/7143930?v=4)](https://github.com/satokadumasa "satokadumasa (32 commits)")

### Embed Badge

![Health badge](/badges/strangerwork-strangerwas/health.svg)

```
[![Health](https://phpackages.com/badges/strangerwork-strangerwas/health.svg)](https://phpackages.com/packages/strangerwork-strangerwas)
```

###  Alternatives

[matomo/device-detector

The Universal Device Detection library, that parses User Agents and detects devices (desktop, tablet, mobile, tv, cars, console, etc.), clients (browsers, media players, mobile apps, feed readers, libraries, etc), operating systems, devices, brands and models.

3.5k23.5M111](/packages/matomo-device-detector)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.4k37.3k](/packages/matomo-matomo)[pods-framework/pods

Pods is a development framework for creating, extending, managing, and deploying customized content types in WordPress.

1.1k1.7k](/packages/pods-framework-pods)[rock-symphony/rock-symphony

Fork of symfony 1.4 with dic, form enhancements, latest swiftmailer and better performance

19164.1k3](/packages/rock-symphony-rock-symphony)[mediawiki/translate

The only standard solution to translate any kind of text with an avant-garde web interface within MediaWiki, including your documentation and software

457.9k](/packages/mediawiki-translate)

PHPackages © 2026

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