doc:install
Interactive installation wizard
doc:install
The doc:install command is an interactive wizard that configures OI Laravel Documentation in your Laravel application. It handles all necessary setup steps automatically.
Command Syntax
php artisan doc:install {--force}Basic Usage
Run the installation wizard:
php artisan doc:installThe wizard will guide you through each step with prompts.
Installation Steps
Step 1: Publish Configuration
Publishes the configuration file to config/oi-documentation.php:
Publishing configuration...
ā Configuration published to config/oi-documentation.php
The configuration file includes all available options for customizing the package.
Step 2: Middleware Selection
Prompts you to choose access control:
How should documentation access be controlled?
[1] Public - Anyone can view documentation
[2] Authenticated - Only logged-in users can view
[3] Custom - Specify custom middleware
Option 1 - Public:
- No authentication required
- Anyone can access documentation
- Middleware:
['web']
Option 2 - Authenticated:
- Only logged-in users can view
- Redirects unauthenticated users to login
- Middleware:
['web', 'auth']
Option 3 - Custom:
- Define your own middleware stack
- For role-based or specialized access control
- Prompts you to enter middleware names
Select an option (default is 1):
Example custom middleware input:
Select middleware [web]: web, auth, verified
### Step 3: Publish Routes
Publishes route definitions:
Publishing routes... ā Routes published to routes/documentation.php
The route file is included in your web routes and can be customized if needed.
### Step 4: Create Documentation Directory
Creates the documentation file structure:
Creating documentation directory structure... ā Documentation directory created at resources/markdown/docs/ ā Sample content created
Creates:
- `resources/markdown/docs/meta.json` - Root documentation metadata
- `resources/markdown/docs/getting-started/` - Getting started section
- Sample markdown files with documentation examples
### Step 5: Publish React Components
Extracts customizable React components:
Publishing React components... ā Components published to resources/js/components/documentation/
Components include:
- `DocumentationLayout.tsx` - Main layout wrapper
- `DocumentationNavigation.tsx` - Sidebar navigation
- `DocumentationSearch.tsx` - Search interface
- `DocumentationMarkdownContent.tsx` - Markdown renderer
- And more...
All components are fully customizable since they're in your project.
### Step 6: Check and Install NPM Dependencies
Verifies required npm packages:
Checking npm dependencies... ā Required packages found or installing...
Automatically installs if missing:
- `react-markdown`
- `react-syntax-highlighter`
- `shiki`
- `lucide-react`
- `@radix-ui/react-*`
- And dependencies
### Step 7: Install ShadCN Sonner
Installs toast notification library:
Installing ShadCN Sonner for toast notifications... ā Sonner installed
Provides toast notifications for user feedback.
### Step 8: Final Verification
ā Installation complete!
Your documentation is ready at: http://localhost:8000/documentation
Next steps:
- npm run build (or npm run dev)
- Visit the URL above
- Edit docs in resources/markdown/docs/
## Options
### --force
Force reinstallation, overwriting existing files:
```bash
php artisan doc:install --force
Use this when:
- Fixing corrupted component files
- Updating to a new package version
- Re-running installation after manual changes
Warning: This will overwrite existing component files and configuration. Back up customizations first.
Troubleshooting Installation
"Configuration file already exists"
The configuration was already published. Skip this step or use --force to overwrite:
php artisan doc:install --force"NPM package installation failed"
Install manually:
npm install react-markdown react-syntax-highlighter shiki lucide-react"Components not loading"
Rebuild assets:
npm run buildOr with hot reload:
npm run dev"Documentation URL not found"
Ensure:
- Routes are registered in
bootstrap/app.php - NPM build is complete
- Middleware configuration is correct
Regenerate navigation:
php artisan doc:gen-navRoute prefix changed by wizard
The prefix set during installation is saved to config. To change it:
// config/oi-documentation.php
'route' => [
'prefix' => 'documentation', // Change this
],Then regenerate:
php artisan doc:gen-navPost-Installation
After installation completes:
-
Build assets:
bashnpm run build -
Visit documentation:
http://localhost:8000/documentation -
Start editing:
- Edit files in
resources/markdown/docs/ - Add new sections and pages
- Regenerate navigation as needed
- Edit files in
-
Optional: Customize components:
- Edit React components in
resources/js/components/documentation/ - Update styling and layout
- Customize colors and themes
- Edit React components in
Generated Files
The wizard creates/publishes these files:
config/oi-documentation.php # Configuration file
routes/documentation.php # Route definitions
resources/markdown/docs/ # Documentation directory
āāā meta.json # Root metadata
āāā getting-started/
ā āāā meta.json
ā āāā _index.md
āāā ...
resources/js/components/documentation/ # React components
āāā DocumentationLayout.tsx
āāā DocumentationNavigation.tsx
āāā DocumentationSearch.tsx
āāā ...
Re-running Installation
Run the wizard again to:
- Update configuration
- Change middleware settings
- Reinstall components
- Update dependencies
Use --force to skip confirmation prompts:
php artisan doc:install --forceNext Steps
After installation: