TirotirPHP
Learn and write PHP faster: 65 ready-to-run examples in English and Persian, a Run button, a built-in web server, syntax checking and project scaffolding. فارسی: پایین صفحه.
Quick start
- Open a
.php file, type php01 and press Tab. (Ctrl+Space on an empty word lists everything.)
- Click ▶ PHP in the status bar (or the Run button at the top right) to run the file.
- PHP not found? Run TirotirPHP: Check PHP Setup from the Command Palette (
Ctrl+Shift+P).
Features
- Run in one click: the
PHP button in the status bar, the Run button in the editor title, or right-click a file in the Explorer. Console scripts print in the Output panel; web pages (forms, sessions, $_GET/$_POST) start PHP's built-in server and open in VS Code's browser tab.
- Server indicator: a
:8000 item appears in the status bar while the server runs. Click it to reopen the page or stop the server. A busy port is skipped automatically. Opening / in a folder without index.php shows a clickable list of your files.
- 65 examples, from Hello World to PHP 8, OOP, PDO, login, CSRF and JSON APIs. Insert them with a prefix (
php01, tt-hello-world) or from Insert Example... (search, topics, preview).
- Related files in one step: Insert Related Files... creates form + handler, safe upload, phonebook (MySQL), a complete login system (SQLite) and a Composer project.
- Syntax errors underlined when you open or save a file (
php -l, your code is never executed).
- New Project: config, PDO layer, escape/CSRF helpers, safe
uploads/, optional Docker (PHP + Apache + MySQL + phpMyAdmin).
- Practice mode: small exercises with
TODOs and Show Solution.
- English / Persian: set
tirotirphp.language to fa for Persian comments and right-to-left pages.
All examples: EXAMPLES.md.
Settings
| Setting |
Default |
Purpose |
tirotirphp.language |
en |
en or fa |
tirotirphp.phpPath |
php |
Path to the PHP executable |
tirotirphp.runMode |
auto |
auto, cli or server |
tirotirphp.server.port |
8000 |
Preferred server port |
tirotirphp.server.openIn |
simpleBrowser |
simpleBrowser, externalBrowser, none |
tirotirphp.lintOnSave |
true |
Syntax check on open and save |
tirotirphp.showStatusBar |
true |
Show the Run button in the status bar |
Good to know
- Needs PHP installed (XAMPP, Laragon or php.net). Running PHP is disabled in untrusted workspaces.
- PHP's built-in server is for development only.
- Upgrading from 1.x:
php01..php34 and phpw still work (without the <?). See the CHANGELOG.
Issues and ideas: https://github.com/tirotir-ir/TirotirPHP · MIT license
فارسی
TirotirPHP یادگیری و نوشتن PHP را سریع میکند: ۶۵ مثال آمادهٔ اجرا به انگلیسی و فارسی، دکمهٔ اجرا، سرور داخلی، بررسی نحو و ساخت پروژه.
شروع سریع
۱. یک فایل .php باز کنید، php01 را تایپ کنید و Tab بزنید. (با Ctrl+Space روی کلمهٔ خالی همه را ببینید.)
۲. روی ▶ PHP در نوار وضعیت (یا دکمهٔ Run بالا سمت راست) کلیک کنید تا فایل اجرا شود.
۳. PHP پیدا نشد؟ از Ctrl+Shift+P دستور TirotirPHP: بررسی نصب PHP را اجرا کنید.
امکانات
- اجرا با یک کلیک: دکمهٔ
PHP در نوار وضعیت، دکمهٔ Run در عنوان ویرایشگر، یا راستکلیک روی فایل در Explorer. اسکریپتهای کنسولی در پنل Output چاپ میشوند؛ صفحههای وب (فرم، سشن، $_GET/$_POST) سرور داخلی PHP را اجرا میکنند و در تب مرورگر VS Code باز میشوند.
- نشانگر سرور: تا وقتی سرور روشن است آیتم
:8000 در نوار وضعیت دیده میشود. با کلیک روی آن صفحه را دوباره باز یا سرور را متوقف کنید. اگر پورت مشغول باشد، پورت بعدی خودکار انتخاب میشود. اگر پوشه index.php نداشته باشد، باز کردن / فهرست قابلکلیک فایلها را نشان میدهد.
- ۶۵ مثال از Hello World تا PHP 8، شیگرایی، PDO، ورود، CSRF و API با JSON. با پیشوند (
php01، tt-hello-world) یا از درج مثال... (جستجو، موضوعها، پیشنمایش) درج کنید.
- فایلهای مرتبط با یک دستور: درج فایلهای مرتبط... فرم و پردازشگر، آپلود امن، دفترچه تلفن (MySQL)، سامانهٔ ورود کامل (SQLite) و پروژهٔ Composer را میسازد.
- خطاهای نحوی زیرخطدار میشوند هنگام باز یا ذخیره (
php -l؛ کد شما هرگز اجرا نمیشود).
- پروژهٔ جدید: تنظیمات، لایهٔ PDO، توابع escape و CSRF، پوشهٔ امن
uploads/ و داکر اختیاری.
- حالت تمرین: تمرینهای کوچک با
TODO و دستور نمایش پاسخ.
- فارسی / انگلیسی: تنظیم
tirotirphp.language را روی fa بگذارید تا کامنتها فارسی و صفحهها راستبهچپ شوند.
نکتهها
- به PHP نصبشده نیاز دارد (XAMPP، Laragon یا php.net). در فضای کاری نامطمئن اجرای PHP غیرفعال است.
- سرور داخلی PHP فقط برای توسعه است.
- پیشوندهای قدیمی
php01 تا php34 و phpw همچنان کار میکنند (بدون <?).
| |