がるの健忘録

エンジニアでゲーマーで講師で占い師なおいちゃんのブログです。

フレームワークで「使われてる関数&クラス&メソッド」簡単に調査してみた

すんげぇ斜めに調査。
一旦の対象は、cakePHP、Laravel、CodeIgniter、Slimの4種。
ちと前に「その当時の最新版」をインストールした環境が残ってたので、一旦はそれつかって簡単に確認。


「全フレームワークで使われている関数&クラス」と「各フレームワークの使用量上位」。
調査には https://github.com/gallu/little-tools/blob/master/php_used_function_analysis.php 使いました。
やり方はおおむね

php php_used_function_analysis.php laravel_test/vendor/ > laravel
php php_used_function_analysis.php CodeIgniter-3.1.0/system/ > codeigniter
php php_used_function_analysis.php cake_test/vendor/ > cake
php php_used_function_analysis.php slim_test/vendor/ > slim

こんな感じ。
大体、各フレームワークのvendor配下のブツをまるっと調査対象。


細かい分析とかバージョンの変更とか種類の追加とかは後日やるとして、今回は雑感と生データだけ。


「全体で使われてる子たち」を見ての雑感
ReflectionClass、ReflectionObject あるなぁ、と。この辺は「フレームワークならでは」なのかしらん??
class_existsとかちょっと下がってfile_exists、interface_existsとかproperty_existsとか同上。
is系の型チェックも各種取り揃え。
mt_randも興味深く。
version_compareもあるよねぇ的な。
extension_loadedも結構ちゃんとチェックしてるのねぇ。
usleepへぇ。
__destructが「全部のフレームワークにとりあえず存在している」のも興味深く。いやおいちゃん的には好みな方向なのですが。
register_shutdown_functionもあるかぁやっぱり。
clearstatcacheが「全部のフレームワーク」で使ってるのか興味深い。
memory_get_usageとかあるやっぱり気になるんだねぇ。
ctype_digitとかctype_alphaとかctype_alnumとか、おいちゃんは好みだけど、へぇへぇへぇ。
is_uploaded_file & move_uploaded_file も地味に健在w


フレームワークは………まぁ「コード量」が違うから色々とあるなぁ、的な。

全域で使われてる子

class method __construct
class Exception
function sprintf
function count
function substr
function is_array
function preg_match
function strlen
class DateTime
function str_replace
function array_merge
function strpos
function implode
class RuntimeException
function is_null
function is_string
function in_array
function explode
class stdClass
function function_exists
function func_get_args
function get_class
function trim
function strtolower
class ReflectionClass
function class_exists
function method_exists
function array_map
function dirname
function preg_replace
function array_keys
function array_key_exists
function mt_rand
function is_object
function file_get_contents
function str_repeat
function call_user_func
function time
function array_pop
function array_shift
function call_user_func_array
class PDO
function current
function array_values
function file_exists
function rewind
function fopen
class DateTimeZone
function reset
function defined
function stream_get_contents
function trigger_error
function unlink
function key
function ord
function is_callable
function rtrim
function realpath
function version_compare
function strtotime
function array_replace
function serialize
function fclose
function unserialize
function is_dir
function chr
class method __call
function is_bool
function sort
function ini_get
function is_numeric
function flush
function getenv
function fwrite
function is_int
function var_export
function copy
function preg_split
function preg_quote
function array_unique
function base64_encode
function array_slice
function is_resource
function strtoupper
function array_unshift
function fread
function date
function microtime
function intval
class error
class BadMethodCallException
function error_reporting
function preg_replace_callback
function extension_loaded
function file
function set_error_handler
function gettype
function func_num_args
function strtr
function ob_start
function join
function end
function is_file
class ReflectionObject
function ucfirst
function strrpos
function ltrim
function mkdir
function hexdec
class UnexpectedValueException
function filter_var
function array_flip
function array_diff
function interface_exists
function ini_set
class method __get
function basename
function preg_match_all
function array_reverse
function hash
function define
function mb_strlen
function usleep
function bin2hex
function rename
function header
function is_scalar
function exec
function htmlspecialchars
function glob
function mb_substr
function md5
function substr_count
function touch
function property_exists
function is_readable
function is_subclass_of
function stripos
function round
function is_float
function rmdir
function pathinfo
function ksort
class DateInterval
function escapeshellarg
function floor
function feof
class method __destruct
function error_get_last
function uniqid
function func_get_arg
function http_build_query
function date_default_timezone_get
function debug_backtrace
function array_search
function constant
function each
function is_writable
function chmod
function array_intersect_key
function mb_convert_encoding
function substr_replace
function flock
function extract
function rawurlencode
class method __isset
function ob_get_level
function fgets
function get_resource_type
function iconv
function base64_decode
function shell_exec
function register_shutdown_function
class method __set
function ob_end_clean
function vsprintf
class directory
function set_exception_handler
function array_intersect
function abs
function ceil
function print_r
function parse_url
function strncmp
function ftruncate
function addcslashes
function array_sum
function array_walk
function parse_str
function mb_strtolower
function gmdate
function clearstatcache
function mb_strpos
function wordwrap
function array_replace_recursive
function memory_get_usage
function get_object_vars
function strcasecmp
function strstr
function ctype_digit
function error_log
function stream_set_timeout
function ctype_alpha
function str_ireplace
function ob_get_contents
function array_change_key_case
function mail
function ctype_alnum
function strcspn
function is_uploaded_file
function move_uploaded_file

cakePHP 3.5.5

function var_dump 67683
function sprintf 1518
class method __construct 1142
class Exception 1108
function substr 918
function count 797
function is_array 698
function strlen 664
class RuntimeException 648
function File 617
function strpos 604
function preg_match 595
function implode 570
class InvalidArgumentException 568
function str_replace 524
function in_array 498
function strtolower 423
function explode 392
function is_string 380
function trim 375
function str_repeat 372
function array_merge 360
function dirname 259
function preg_replace 238
function array_map 227
function array_keys 213
function realpath 201
function file_put_contents 195
function end 195
function file_get_contents 188
function is_dir 185
function file_exists 184
function rtrim 183
function array_pop 173
function function_exists 160
function array_filter 158
function defined 156
function array_key_exists 153
function get_class 153
function class_exists 146
function define 145
class LogicException 140
function rewind 140
class Error 137
function current 137
function getenv 136
class PDO 134
function trigger_error 133
function Hash 129
function strtoupper 128
function Link 127
function time 125
function max 122
function is_numeric 120
function is_object 118
function Log 114
function key 105
function array_values 104
function getType 103
function extract 102
function mkdir 102
function putenv 101

CodeIgniter 3.1.0

function count 281
function is_array 243
function function_exists 207
function defined 187
function str_replace 130
function preg_match 124
class method __construct 119
function strlen 118
function strpos 117
function substr 109
function in_array 103
function implode 99
function preg_replace 89
function strtolower 88
function file_exists 87
function trim 81
function strtoupper 72
function sprintf 52
function pack 47
function class_exists 47
function explode 46
function is_string 46
function array_keys 44
function date 44
function is_int 41
function is_object 37
function time 36
function rtrim 36
function is_bool 31
function md5 30
class stdClass 29
function ord 28
function sscanf 26
function is_numeric 26
function is_resource 26
function array_merge 26
function header 23
function version_compare 23
class directory 22
function trigger_error 22
function preg_match_all 21
function ctype_digit 21
function mb_strlen 21
function stripos 21
function method_exists 21
function preg_quote 21
function htmlspecialchars 20
class error 20
function is_dir 20
function ini_get 20

Laravel Framework 5.5.20

class method __construct 1816
class Exception 1480
function sprintf 1299
function count 785
function substr 701
class InvalidArgumentException 651
function is_array 494
function preg_match 474
function strlen 457
class DateTime 447
function str_replace 436
function Assert 422
function array_merge 421
function strpos 414
function implode 412
class RuntimeException 409
class Generator 393
function is_null 363
function is_string 361
function in_array 326
function explode 320
class stdClass 318
function function_exists 315
function func_get_args 305
class Closure 304
function get_class 302
function trim 278
function strtolower 239
class ReflectionClass 233
class Reflection 231
function class_exists 214
function method_exists 212
class generator 205
class LogicException 192
function array_map 191
function dirname 189
class method __toString 183
function preg_replace 177
function array_keys 174
function array_key_exists 160
function mt_rand 153
function is_object 152
function file_get_contents 151
class Error 151
function str_repeat 148
function call_user_func 147
function time 141
class ERROR 136
function range 135
function array_pop 132
function array_shift 130
function call_user_func_array 128
class PDO 125
function current 123
function json_encode 119
function array_values 118
function file_exists 114
function rewind 114
function File 114
function fopen 113
class DateTimeZone 113
function array_filter 111
function reset 108
function defined 108
class DOMDocument 103

Slim 3.?.?*1

function sprintf 499
class method __construct 450
class Exception 332
class stdClass 258
function count 236
class Reflection 215
class InvalidArgumentException 182
class DateTime 178
function is_string 163
function substr 162
function call_user_func_array 161
function func_get_args 161
function get_class 147
class RuntimeException 134
function Assert 126
function is_array 122
class ERROR 120
function strpos 118
function preg_match 118
class ReflectionClass 111
function strlen 106
function implode 94
function array_merge 92
class DateTimeZone 85
function is_object 83
class method __toString 82
function str_replace 79
function dirname 79
function class_exists 76
function trim 74
function range 73
function json_encode 67
function in_array 67
function is_bool 59
function explode 57
function method_exists 56
function file_get_contents 51
function current 49
function array_keys 48
function trigger_error 47
function array_shift 44
function fopen 44
class DOMDocument 37
function log 37
class ArrayObject 37
function defined 37
function strtolower 37
class SplObjectStorage 36
class ReflectionMethod 36
function call_user_func 35
function version_compare 35
function fread 34
function array_map 34
function is_resource 33
function file_exists 33
function fseek 32
function var_export 32
class generator 31
function function_exists 31
function date 31
function key 31
function is_null 30
function json_decode 30

*1:バージョン確認の仕方が不明でした……