4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Slim3_PHPAdvent Calendar 2018

Day 2

人生初のphpフレームワークでボクがLaravelでなくSlim3を選択した理由

Last updated at Posted at 2018-12-14

目次

Slim3_PHP Advent Calendar 2018
こちらから順番に追えます。

なぜSlim3?

※今回の記事は個人的感想が多いので悪しからず。

Less Is More

この考え方、しゅき……

Slim3はとてもとてもシンプル、軽量フレームワークと言われるだけあります。

では実際にどれだけ軽量か、Laravelちゃんと比較してみましょう。

実測

XAMPPのhtdocsディレクトリに新しくslimlaravelディレクトリを作って(別にファイル名は何でもいい)、それぞれインストールされるものとサイズを比較してみましょう。

Slimをインストール

slimディレクトリ内でShift + 右クリックにて、WIndows PowerShellを起動し、以下のコマンドでSlimをインストール!

composer require slim/slim
ユーザー名MacBook:slim3 ユーザー名$ composer require slim/slim

Using version ^3.11 for slim/slim
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 6 installs, 0 updates, 0 removals
  - Installing psr/container (1.0.0): Loading from cache #1
  - Installing container-interop/container-interop (1.2.0): Loading from cache #2
  - Installing nikic/fast-route (v1.3.0): Loading from cache #3
  - Installing psr/http-message (1.0.1): Loading from cache #4
  - Installing pimple/pimple (v3.2.3): Loading from cache #5
  - Installing slim/slim (3.11.0): Loading from cache #6
Writing lock file
Generating autoload files

6つですね、Slimを動かすために本体含め6つのパッケージがインストールされました。

スクリーンショット 2018-12-14 9.51.00.png

0.6MBですね。

Laravel

katouyuoMacBook:slim3 yuki$ cd ../laravel/
katouyuoMacBook:laravel yuki$ composer require laravel/laravel
Using version ^5.7 for laravel/laravel
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 54 installs, 0 updates, 0 removals
  - Installing symfony/polyfill-php72 (v1.10.0): Loading from cache #1
  - Installing symfony/polyfill-mbstring (v1.10.0): Loading from cache #2
  - Installing symfony/var-dumper (v4.2.1): Loading from cache #3
  - Installing symfony/contracts (v1.0.2): Loading from cache #4
  - Installing symfony/console (v4.2.1): Loading from cache #5
  - Installing psr/log (1.1.0): Loading from cache #6
  - Installing symfony/debug (v4.2.1): Loading from cache #7
  - Installing nikic/php-parser (v4.1.0): Loading from cache #8
  - Installing jakub-onderka/php-console-color (v0.2): Loading from cache #9
  - Installing jakub-onderka/php-console-highlighter (v0.4): Loading from cache #10
  - Installing dnoegel/php-xdg-base-dir (0.1): Loading from cache #11
  - Installing psy/psysh (v0.9.9): Loading from cache #12
  - Installing vlucas/phpdotenv (v2.5.1): Loading from cache #13
  - Installing symfony/css-selector (v4.2.1): Loading from cache #14
  - Installing tijsverkoyen/css-to-inline-styles (2.2.1): Loading from cache #15
  - Installing symfony/routing (v4.2.1): Loading from cache #16
  - Installing symfony/process (v4.2.1): Loading from cache #17
  - Installing symfony/polyfill-ctype (v1.10.0): Loading from cache #18
  - Installing symfony/http-foundation (v4.2.1): Loading from cache #19
  - Installing symfony/event-dispatcher (v4.2.1): Loading from cache #20
  - Installing symfony/http-kernel (v4.2.1): Loading from cache #21
  - Installing symfony/finder (v4.2.1): Loading from cache #22
  - Installing doctrine/lexer (v1.0.1): Loading from cache #23
  - Installing egulias/email-validator (2.1.7): Loading from cache #24
  - Installing swiftmailer/swiftmailer (v6.1.3): Loading from cache #25
  - Installing paragonie/random_compat (v9.99.99): Loading from cache #26
  - Installing ramsey/uuid (3.8.0): Loading from cache #27
  - Installing psr/simple-cache (1.0.1): Loading from cache #28
  - Installing psr/container (1.0.0): Loading from cache #29
  - Installing opis/closure (3.1.1): Loading from cache #30
  - Installing symfony/translation (v4.2.1): Loading from cache #31
  - Installing nesbot/carbon (1.36.1): Loading from cache #32
  - Installing monolog/monolog (1.24.0): Loading from cache #33
  - Installing league/flysystem (1.0.49): Loading from cache #34
  - Installing erusev/parsedown (1.7.1): Loading from cache #35
  - Installing dragonmantank/cron-expression (v2.2.0): Loading from cache #36
  - Installing doctrine/inflector (v1.3.0): Loading from cache #37
  - Installing guzzlehttp/promises (v1.3.1): Loading from cache #38
  - Installing ralouphie/getallheaders (2.0.5): Loading from cache #39
  - Installing psr/http-message (1.0.1): Loading from cache #40
  - Installing guzzlehttp/psr7 (1.5.2): Loading from cache #41
  - Installing guzzlehttp/guzzle (6.3.3): Loading from cache #42
  - Installing laravel/slack-notification-channel (v1.0.3): Loading from cache #43
  - Installing laravel/framework (v5.7.17): Loading from cache #44
  - Installing lcobucci/jwt (3.2.5): Loading from cache #45
  - Installing php-http/promise (v1.0.0): Loading from cache46 #
  - Installing php-http/httplug (v1.1.0): Loading from cache #47
  - Installing php-http/guzzle6-adapter (v1.1.1): Loading from cache #48
  - Installing zendframework/zend-diactoros (1.8.6): Loading from cache #49
  - Installing nexmo/client (1.5.2): Loading from cache #50
  - Installing laravel/nexmo-notification-channel (v1.0.1): Loading from cache #51
  - Installing laravel/tinker (v1.0.8): Loading from cache #52
  - Installing fideloper/proxy (4.0.0): Loading from cache #53
  - Installing laravel/laravel (v5.7.15): Loading from cache #54
##長すぎるのでダウンロード以外の処理は中略##
Writing lock file
Generating autoload files

54つですね、Laravelを動かすために本体含め54つのパッケージがインストールされました。
多い……これ使いこなせる気がしないですよね。

これからWebアプリを作ろうと思っている人にとってはアプリを作るために勉強に時間がかなりかかって主な目的を忘れるなんてこと、普通にありそうですねこれ。

スクリーンショット 2018-12-14 10.11.39.png

16.5MBですね(困惑
約27倍くらいデカイです。

まとめ

玄人や、phpと一緒にLaravelを学んだ人はLaravelを使うのが吉

phpだけを学んでこれからなにかWebアプリを構築したいのであれば規模にかかわらず、学習コストの低いSlimを使ってフレームワークでどんな事ができるのか、それを確認してみるのが吉

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?