PHP cheatsheet ( linux)
In progress...
High-level plan:
- Update system
- Install PHP (modern version) + essential extensions
- Install Composer (PHP’s dependency manager)
- Install Laravel (PHP framework)
- Test the environment
Note: This was done on Ubuntu 24.04 with root/sudo access
Update the system
- sudo apt update
- sudo apt upgrade -y
Install PHP (modern version) + essential extensions
- check if php exists with php -v
Laravel-ready set:
sudo apt install -y php8.3-cli php8.3-fpm php8.3-mbstring php8.3-xml php8.3-curl php8.3-zip php8.3-sqlite3 php8.3-mysql php8.3-bcmath php8.3-gd php8.3-intl
this time php -v returns similar to this :
PHP 8.3.6 (cli) (built: May 25 2026 13:12:06) (NTS)
Install Composer (PHP’s package manager):
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
-
composer --version returns composer create-project laravel/laravel my_project
What this does?
- Downloads a fresh Laravel app into a folder called my_project.
- Uses Composer to install all required PHP packages (routing, auth tools, DB layer, etc.) into vendor/.
- Sets up the default folder structure and configurations.
cd hutfx_pov && php artisan --version. For me it was Laravel Framework 13.13.0.-
cd my_project-
php artisan servecode --install-extension bmewburn.vscode-intelephense-clientcode --install-extension felixfbecker.php-debugcode --install-extension amiralizadeh9480.laravel-extra-intellisensecode --install-extension onecentlin.laravel5-snippets || true code --install-extension mikestead.dotenv || true code --install-extension eamodio.gitlens || true code --install-extension esbenp.prettier-vscode || true code --install-extension dbaeumer.vscode-eslint || true- npm install - Installs all JavaScript/TypeScript/CSS dependencies listed in package.json. Laravel uses Vite + Tailwind for front-end. This downloads them into node_modules so they can run.
- npm run build - Runs a build script (via Vite) that compiles your assets.Processes Tailwind CSS into a final CSS file. Bundles/minifies JS and CSS. Outputs ready-to-use files (e.g., public/build/) that Blade can load with @vite.
return view('name_of_the_page');
});
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>name of the page</title>
@vite('resources/css/app.css')
</head>
<body class="min-h-screen bg-slate-950 text-slate-100 p-6">
<header class="mb-6 flex items-center justify-between">
<h1 class="text-2xl font-semibold tracking-tight">My page</h1>
<div class="text-xs text-slate-400">Local dev view</div>
</header>
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
<!-- Large box: <My box 1 -->
<section class="col-span-1 sm:col-span-2 bg-slate-900 border border-slate-800 rounded-xl p-4">
<div class="text-sm font-medium text-slate-300 mb-1">5q's Data</div>
<div class="text-xs text-slate-400">
- Ingestion status: <span class="text-emerald-400">OK</span><br>
- Last update: 00:02 ago<br>
- Active sources: 14
</div>
</section>
<!-- Large box: My box 2 -->
<section class="col-span-1 sm:col-span-2 bg-slate-900 border border-slate-800 rounded-xl p-4">
<div class="text-sm font-medium text-slate-300 mb-1">My box 2</div>
<div class="text-xs text-slate-400">
- Rendered charts: 8<br>
- Load time: 180ms<br>
- Errors: 0
</div>
</section>
<!-- Large box: My box 3 -->
<section class="col-span-1 sm:col-span-2 bg-slate-900 border border-slate-800 rounded-xl p-4">
<div class="text-sm font-medium text-slate-300 mb-1">My box 3</div>
<div class="text-xs text-slate-400">
- Online: 37<br>
- Offline: 2<br>
- Uptime: 99.8%
</div>
</section>
<!-- Large box: My box 4 -->
<section class="col-span-1 sm:col-span-2 bg-slate-900 border border-slate-800 rounded-xl p-4">
<div class="text-sm font-medium text-slate-300 mb-1">My box 4</div>
<div class="text-xs text-slate-400">
- Models active: 3<br>
- Last run: 00:11 ago<br>
- Next run: 19:00
</div>
</section>
<!-- Small box: My small box 1 -->
<section class="col-span-1 bg-slate-900 border border-slate-800 rounded-xl p-3">
<div class="text-xs font-medium text-slate-300 mb-1">My small box 1</div>
<div class="text-[10px] text-slate-400">
- Status: Monitoring<br>
- Signals: 24
</div>
</section>
<!-- Small box: My small box 2 -->
<section class="col-span-1 bg-slate-900 border border-slate-800 rounded-xl p-3">
<div class="text-xs font-medium text-slate-300 mb-1">My small box 2</div>
<div class="text-[10px] text-slate-400">
- Online: Yes<br>
- Users online: 12
</div>
</section>
</div>
</body>
</html>
