laravelをインストールした時に同梱されているもの

# laravel10をインストールした時に同梱されているもの
どれがどれだったかっていう時のためのものです。
ちなみにLaravel10をインストールしました。

## laravelインストール時のトップディレクトリ直下はこんな感じです。
```
$ ls -la
drwxr-xr-x  7 root root   4096 Aug 10 16:19 app
-rwxr-xr-x  1 root root   1686 Aug 10 16:19 artisan
drwxr-xr-x  3 root root   4096 Aug 10 16:19 bootstrap
-rw-r--r--  1 root root   1882 Aug 10 16:19 composer.json
-rw-r--r--  1 root root 295680 Sep 14 16:43 composer.lock
drwxr-xr-x  2 root root   4096 Aug 10 16:19 config
drwxr-xr-x  5 root root   4096 Aug 10 16:19 database
-rw-r--r--  1 root root    258 Aug 10 16:19 .editorconfig
-rw-r--r--  1 root root   1148 Sep 14 16:43 .env
-rw-r--r--  1 root root   1097 Aug 10 16:19 .env.example
-rw-r--r--  1 root root    186 Aug 10 16:19 .gitattributes
-rw-r--r--  1 root root    243 Aug 10 16:19 .gitignore
-rw-r--r--  1 root root    248 Aug 10 16:19 package.json
-rw-r--r--  1 root root   1084 Aug 10 16:19 phpunit.xml
drwxr-xr-x  2 root root   4096 Aug 10 16:19 public
-rw-r--r--  1 root root   4158 Aug 10 16:19 README.md
drwxr-xr-x  5 root root   4096 Aug 10 16:19 resources
drwxr-xr-x  2 root root   4096 Aug 10 16:19 routes
drwxr-xr-x  5 root root   4096 Aug 10 16:19 storage
drwxr-xr-x  4 root root   4096 Aug 10 16:19 tests
drwxr-xr-x 39 root root   4096 Sep 14 16:43 vendor
-rw-r--r--  1 root root    263 Aug 10 16:19 vite.config.js
```


特にこの中のファイルになっているものがよくわからない人も多いんじゃないでしょうか（以下列挙）
- artisan
- composer.json
- composer.lock
- .editorconfig
- .env
- .env.example
- .gitattributes
- .gitignore
- package.json
- phpunit.xml
- README.md
- vite.config.js
調べたので一つずつ書いていきます。

### artisan
開いてみるとわかるけど、phpのファイルです。
```php:artisan
<?php

define('LARAVEL_START', microtime(true));

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any of our classes manually. It's great to relax.
|
*/

require __DIR__.'/vendor/autoload.php';

$app = require_once __DIR__.'/bootstrap/app.php';

/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/

$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);

$status = $kernel->handle(
    $input = new Symfony\Component\Console\Input\ArgvInput,
    new Symfony\Component\Console\Output\ConsoleOutput
);

/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running, we will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/

$kernel->terminate($input, $status);

exit($status);
```

つまりphpのスクリプトであり、コマンドラインから直接実行することができ、以下のような形で使います。
```
$ php artisan 引数
```
artisanを使うことで、laravelでいろんな操作が行えます。

### composer.json
このファイルはプロジェクトが依存するPHPパッケージとかライブラリを管理（定義）してくれるファイルです。
```json:composer.json
{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The skeleton application for the Laravel framework.",
    "keywords": ["laravel", "framework"],
    "license": "MIT",
    "require": {
        "php": "^8.1",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^10.10",
        "laravel/sanctum": "^3.2",
        "laravel/tinker": "^2.8"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "laravel/pint": "^1.0",
        "laravel/sail": "^1.18",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^7.0",
        "phpunit/phpunit": "^10.1",
        "spatie/laravel-ignition": "^2.0"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "pestphp/pest-plugin": true,
            "php-http/discovery": true
        }
    },
    "minimum-stability": "stable",
    "prefer-stable": true
}
```

確かにsanctum,tinker,fakerとか見覚えありますよね。
### composer.lock
composerでインストールされたものの、具体的なバージョンがjson形式で記載されてます。
長いので中略してます。
```json:composer.lock
{
    "_readme": [
        "This file locks the dependencies of your project to a known state",
        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
        "This file is @generated automatically"
    ],


〜〜〜〜〜〜〜〜中略〜〜〜〜〜〜〜〜


    "platform-dev": [],
    "plugin-api-version": "2.6.0"
}
```
sanctumのところなんか見るとこんな感じで書いています。
```json
{
    "name": "laravel/sanctum",
    "version": "v3.3.1",
    "source": {
        "type": "git",
        "url": "https://github.com/laravel/sanctum.git",
        "reference": "338f633e6487e76b255470d3373fbc29228aa971"
    },
〜〜〜〜〜〜〜〜中略〜〜〜〜〜〜〜〜
}
```
バージョンとかどのソースのコミットから持ってきたかを記してくれてるんですね。

### .editorconfig
異なるエディタやIDE間で一貫したコーディングスタイルを維持するためのファイルみたいです。
```
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
```

### .env
環境変数を定義するファイルです。以下記述例。
```.env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
```

### .env.example
.env ファイルのサンプルです。

### .gitattributes
Gitの挙動をカスタマイズするファイルです。
改行コードの扱いや特定のファイルのdiffをどのように表示するかなどを定義します。
```.gitattributes
* text=auto eol=lf

*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore
```

### .gitignore
Gitリポジトリに追加しないファイルやディレクトリを定義します。
laravelに同梱されてる.gitignoreはnode_modulesやvendorのようなパッケージを格納するフォルダは除外されてます。
```.gitignore
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.env.production
.phpunit.result.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode
```

### package.json
JavaScriptパッケージを定義するファイルです。
```json:package.json
{
    "private": true,
    "type": "module",
    "scripts": {
        "dev": "vite",
        "build": "vite build"
    },
    "devDependencies": {
        "axios": "^1.1.2",
        "laravel-vite-plugin": "^0.8.0",
        "vite": "^4.0.0"
    }
}
```

### phpunit.xml
PHPUnitのテスト設定です。
```xml:phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
         bootstrap="vendor/autoload.php"
         colors="true"
>
    <testsuites>
        <testsuite name="Unit">
            <directory>tests/Unit</directory>
        </testsuite>
        <testsuite name="Feature">
            <directory>tests/Feature</directory>
        </testsuite>
    </testsuites>
    <source>
        <include>
            <directory>app</directory>
        </include>
    </source>
    <php>
        <env name="APP_ENV" value="testing"/>
        <env name="BCRYPT_ROUNDS" value="4"/>
        <env name="CACHE_DRIVER" value="array"/>
        <!-- <env name="DB_CONNECTION" value="sqlite"/> -->
        <!-- <env name="DB_DATABASE" value=":memory:"/> -->
        <env name="MAIL_MAILER" value="array"/>
        <env name="QUEUE_CONNECTION" value="sync"/>
        <env name="SESSION_DRIVER" value="array"/>
        <env name="TELESCOPE_ENABLED" value="false"/>
    </php>
</phpunit>
```
### README.md
プロジェクトの説明、セットアップ手順、その他の重要な情報がMarkdown形式で書かれています。
```md:README.md
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>

<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>

## About Laravel

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:

- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).

Laravel is accessible, powerful, and provides tools required for large, robust applications.

## Learning Laravel

Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.

You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.

If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 2000 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.

## Laravel Sponsors

We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).

### Premium Partners

- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[Many](https://www.many.co.uk)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[OP.GG](https://op.gg)**
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
- **[Lendio](https://lendio.com)**

## Contributing

Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).

## Code of Conduct

In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).

## Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.

## License

The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
```

### vite.config.js
Viteの設定が記述されています。Viteのプラグインやビルドオプション、開発サーバーの設定などがこのファイルで管理されます。
Viteはフロントエンドビルドツールです。
```js:vite.config.js
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
    plugins: [
        laravel({
            input: ['resources/css/app.css', 'resources/js/app.js'],
            refresh: true,
        }),
    ],
});
```

## まとめ
phpやフロントのパッケージ管理、gitの設定などなどです。