Step by step with AMPLE
خطوة بخطوة مع AMPLE
Short, practical guides for the things you do most: start a project, connect a database, test emails, debug, share your work, and move over from XAMPP.
أدلة قصيرة وعملية لأكثر ما تفعله: بدء مشروع، وربط قاعدة بيانات، وتجربة الرسائل، وتصحيح الأخطاء، ومشاركة عملك، والانتقال من XAMPP.
1Your first siteموقعك الأول
- Make sure AMPLE is running: in the panel, Home should say Everything is running. If not, press Start all.
- Create a folder
htdocs\helloinside AMPLE (in the panel: Sites → New site, orample sites new hello). - Inside it, create
index.php:
- تأكد أن AMPLE يعمل: في اللوحة يجب أن تظهر في الرئيسية عبارة Everything is running. وإن لم تظهر، اضغط Start all.
- أنشئ مجلداً
htdocs\helloداخل AMPLE (من اللوحة: Sites ← New site، أوample sites new hello). - أنشئ بداخله ملف
index.php:
<?php echo "Hello!";
Now open http://hello.localhost. That's it: every folder in htdocs is a site, with no setup and no admin rights. It also opens at http://localhost/hello/.
افتح الآن http://hello.localhost. هذا كل شيء: كل مجلد في htdocs هو موقع، دون أي إعداد ودون صلاحيات مدير. ويفتح أيضاً على http://localhost/hello/.
2Laravel
- Make sure
phpandcomposerwork in a terminal: runample path addonce, then open a new terminal. - Create the project inside
htdocs:
- تأكد أن
phpوcomposerيعملان في الطرفية: نفّذample path addمرة واحدة، ثم افتح طرفية جديدة. - أنشئ المشروع داخل
htdocs:
cd C:\ample\htdocs
composer create-project laravel/laravel shop
- Open
http://shop.localhost. AMPLE seesartisanand serves thepublicfolder automatically. - Connect the database in
.env, then run the migrations:
- افتح
http://shop.localhost. يرى AMPLE ملفartisanفيعرض المجلدpublicتلقائياً. - اربط قاعدة البيانات في ملف
.env، ثم نفّذ الترحيلات:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=shop
DB_USERNAME=root
DB_PASSWORD=
ample db new shop
php artisan migrate
Point Laravel at Mailpit and every email lands in your local inbox. See Test emails with Mailpit.
وجّه Laravel إلى Mailpit فتصل كل رسالة إلى صندوق بريدك المحلي. راجع تجربة الرسائل مع Mailpit.
Using C:\ample above as the install folder; use yours if you picked another one.
استخدمنا C:\ample أعلاه كمجلد التثبيت؛ استخدم مجلدك إن اخترت غيره.
3WordPress
- Download WordPress from wordpress.org and unzip it to
htdocs\blog. - Create a database named
blogin phpMyAdmin, or runample db new blog. - Open
http://blog.localhostand use host127.0.0.1, userroot, no password.
- نزّل WordPress من wordpress.org وفك ضغطه في
htdocs\blog. - أنشئ قاعدة بيانات باسم
blogفي phpMyAdmin، أو نفّذample db new blog. - افتح
http://blog.localhostواستخدم العنوان127.0.0.1والمستخدمrootدون كلمة مرور.
Password-reset emails and notifications from WordPress land in Mailpit with no setup, because WordPress uses PHP's mail().
تصل رسائل استعادة كلمة المرور والتنبيهات من WordPress إلى Mailpit دون أي إعداد، لأن WordPress يستخدم الدالة mail().
4Connect PHP to the databaseربط PHP بقاعدة البيانات
MariaDB runs on 127.0.0.1, port 3306, user root, no password (unless you changed it with ample password).
يعمل MariaDB على 127.0.0.1، المنفذ 3306، المستخدم root، دون كلمة مرور (إلا إذا غيّرتها بـ ample password).
$pdo = new PDO("mysql:host=127.0.0.1;dbname=shop;charset=utf8mb4", "root", "");
so Arabic text and emoji are stored correctly. ample db new NAME creates databases in utf8mb4 already.
ليُحفظ النص العربي والرموز التعبيرية بشكل صحيح. ينشئ ample db new NAME قواعد البيانات بـ utf8mb4 مسبقاً.
Use 127.0.0.1, not localhost, as the host: PHP on Windows connects to "localhost" through 127.0.0.1 anyway, and the accounts AMPLE creates are set up for it.
استخدم 127.0.0.1 لا localhost كعنوان: فـ PHP على Windows يتصل بـ «localhost» عبر 127.0.0.1 على أي حال، والحسابات التي ينشئها AMPLE مُعدّة لذلك.
5Test emails with Mailpitتجربة الرسائل مع Mailpit
Mailpit is a fake mail server inside AMPLE. Every email your code sends is caught and shown in its inbox, so you see exactly what your users would receive (subject, HTML, attachments) without anything reaching a real person. Any recipient address works, even made-up ones. Read them at http://localhost/mailpit/ or under Mail in the panel.
Mailpit خادم بريد وهمي داخل AMPLE. كل رسالة يرسلها كودك يلتقطها ويعرضها في صندوق بريده، فترى بالضبط ما سيصل لمستخدميك (العنوان و HTML والمرفقات) دون أن يصل شيء لأي شخص حقيقي. يقبل أي عنوان مستلم، حتى العناوين المخترعة. اقرأ الرسائل على http://localhost/mailpit/ أو من البريد في اللوحة.
Settings for any app
الإعدادات لأي تطبيق
| Settingالإعداد | Valueالقيمة |
|---|---|
| SMTP hostخادم SMTP | 127.0.0.1 |
| SMTP portمنفذ SMTP | 1025 |
| Username / passwordالمستخدم / كلمة المرور | none (any value also works)لا يوجد (وأي قيمة تعمل أيضاً) |
| Encryptionالتشفير | none (no SSL / TLS)بدون (لا SSL ولا TLS) |
| Inboxصندوق البريد | http://localhost/mailpit/ |
Plain PHP: mail()
PHP العادي: mail()
Works with no setup: AMPLE already points PHP at Mailpit in php.ini.
تعمل دون أي إعداد: AMPLE يوجّه PHP إلى Mailpit مسبقاً في php.ini.
<?php
mail('test@example.com', 'Hello', 'It works!');
Laravel
In your project's .env (older Laravel versions use MAIL_ENCRYPTION=null instead of MAIL_SCHEME):
في ملف .env في مشروعك (نسخ Laravel الأقدم تستخدم MAIL_ENCRYPTION=null بدلاً من MAIL_SCHEME):
MAIL_MAILER=smtp
MAIL_HOST=127.0.0.1
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_SCHEME=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
Clear the cached config, then send a test email from Tinker:
امسح الإعدادات المخزنة، ثم أرسل رسالة تجريبية من Tinker:
php artisan config:clear
php artisan tinker
> Mail::raw('It works!', fn ($m) => $m->to('test@example.com')->subject('Hello'));
Symfony
In .env.local:
في ملف .env.local:
MAILER_DSN=smtp://127.0.0.1:1025
PHPMailer
Point it at Mailpit with no login and no encryption:
وجّهه إلى Mailpit دون تسجيل دخول ودون تشفير:
$mail = new PHPMailer\PHPMailer\PHPMailer(true);
$mail->isSMTP();
$mail->Host = '127.0.0.1';
$mail->Port = 1025;
$mail->SMTPAuth = false;
$mail->SMTPAutoTLS = false;
$mail->setFrom('hello@example.com', 'My App');
$mail->addAddress('test@example.com');
$mail->Subject = 'Hello';
$mail->Body = 'It works!';
$mail->send();
WordPress
Nothing to do: WordPress uses mail(). If an SMTP plugin is installed, give it the settings above.
لا شيء تفعله: يستخدم WordPress الدالة mail(). وإن كانت لديك إضافة SMTP فأعطها الإعدادات أعلاه.
From the terminal
من الطرفية
ample mail # the latest emails in Mailpit
ample mail test # send a test email
ample mail clear # delete them all
Make sure Mailpit is running in the panel, and that the port in your app is 1025 (or the SMTP port you set in Settings). Log Doctor shows Mailpit errors too.
تأكد أن Mailpit يعمل في اللوحة، وأن المنفذ في تطبيقك هو 1025 (أو منفذ SMTP الذي ضبطته في الإعدادات). يعرض Log Doctor أخطاء Mailpit أيضاً.
6Switch the PHP versionتبديل نسخة PHP
In the panel open PHP, press Show available versions, download the one you need and make it active. Or from a terminal:
في اللوحة افتح PHP، واضغط Show available versions، وحمّل النسخة التي تحتاجها واجعلها النشطة. أو من الطرفية:
ample php-list # installed versions (* = active)
ample php-add 8.4 # download PHP 8.4 from windows.php.net
ample php-compare 8.4 # what would change (changes nothing)
ample php-use 8.4 # switch, carrying over extensions and settings
Your extensions and php.ini changes follow you to the new version, and Apache restarts on its own. Switch back the same way whenever you like.
تنتقل إضافاتك وتعديلات php.ini معك إلى النسخة الجديدة، ويُعاد تشغيل Apache تلقائياً. ويمكنك العودة بالطريقة نفسها متى شئت.
7Debug with Xdebug and VS Codeتصحيح الأخطاء بـ Xdebug و VS Code
- Run
ample xdebug on. AMPLE downloads the Xdebug build that matches your active PHP. - In VS Code install the PHP Debug extension and add a launch configuration on port
9003:
- نفّذ
ample xdebug on. يحمّل AMPLE نسخة Xdebug المطابقة لنسخة PHP النشطة. - في VS Code ثبّت إضافة PHP Debug وأضف إعداد تشغيل على المنفذ
9003:
{
"version": "0.2.0",
"configurations": [
{ "name": "Listen for Xdebug", "type": "php", "request": "launch", "port": 9003 }
]
}
- Press F5, set a breakpoint and open the page.
- Turn it off afterwards so pages run at full speed:
ample xdebug off.
- اضغط F5، وضع نقطة توقف، وافتح الصفحة.
- أطفئه بعدها لتعمل الصفحات بكامل سرعتها:
ample xdebug off.
8Import a big .sql fileاستيراد ملف .sql كبير
phpMyAdmin has upload limits. AMPLE's import has none: any size, with progress. .sql.gz and .zip files work too.
لـ phpMyAdmin حدود في حجم الرفع. أما استيراد AMPLE فليس له حدود: بأي حجم ومع شريط تقدّم. وتعمل ملفات .sql.gz و .zip أيضاً.
ample import C:\Users\you\Downloads\shop.sql shop
9HTTPS with a padlockHTTPS مع القفل
- Turn it on in the panel (Sites → HTTPS) or run
ample https on. - Run
ample https trustand accept the Windows prompt once (no admin). - Open
https://shop.localhost: the padlock is there.
- فعّله من اللوحة (Sites ← HTTPS) أو نفّذ
ample https on. - نفّذ
ample https trustووافق على رسالة Windows مرة واحدة (دون صلاحيات مدير). - افتح
https://shop.localhost: ستجد القفل.
The certificate only works for localhost names, so it cannot be misused for real websites. New sites are added to it automatically. To undo: ample https untrust and ample https off.
تعمل الشهادة لأسماء localhost فقط، فلا يمكن استغلالها لمواقع حقيقية. وتُضاف المواقع الجديدة إليها تلقائياً. وللتراجع: ample https untrust ثم ample https off.
10Back up your databasesنسخ قواعد البيانات احتياطياً
ample backup # every database, to backups\NAME-DATE.sql.gz
ample backup shop blog # only these
ample import backups\FILE.sql.gz # restore one
Backups are compressed .sql.gz files in the backups folder. Copy them anywhere you like, or import them on another PC that runs AMPLE.
النسخ الاحتياطية ملفات .sql.gz مضغوطة في المجلد backups. انسخها إلى أي مكان، أو استوردها على جهاز آخر يعمل عليه AMPLE.
12Move from XAMPPالانتقال من XAMPP
AMPLE never writes into the XAMPP folder: projects are copied, and databases are exported from a temporary copy of mysql\data, opened with XAMPP's own MariaDB. Every step shows a plan first and only acts when you add --yes.
لا يكتب AMPLE أبداً داخل مجلد XAMPP: تُنسخ المشاريع، وتُصدَّر قواعد البيانات من نسخة مؤقتة من mysql\data تُفتح بـ MariaDB الخاص بـ XAMPP نفسه. كل خطوة تعرض خطة أولاً، ولا تنفّذ إلا عندما تضيف --yes.
- See what can be imported (read-only; Log Doctor also reads XAMPP's logs):
- اعرف ما يمكن استيراده (للقراءة فقط؛ ويقرأ Log Doctor سجلات XAMPP أيضاً):
ample xampp scan
ample xampp scan --path=D:\xampp # if XAMPP is in another folder
- Import, step by step. Run each one without
--yesfirst to read the plan:
- استورد خطوة بخطوة. نفّذ كل أمر دون
--yesأولاً لتقرأ الخطة:
ample xampp import projects --yes # copy htdocs projects (existing AMPLE folders are never overwritten)
ample xampp import databases --yes # stop MySQL in XAMPP first; databases + non-root users and grants
ample xampp import php 1,3 --yes # pick which of YOUR php.ini changes to keep
ample xampp import vhosts --yes # httpd-vhosts.conf -> apache\conf\vhosts (+ NAME.localhost alias)
- Changed your mind? Remove everything that was imported (XAMPP is untouched anyway):
- غيّرت رأيك؟ احذف كل ما استُورد (XAMPP لم يُلمس أصلاً):
ample xampp undo --yes
Only mysql\data is imported (other copies such as data_backup are ignored). Accounts @localhost are also created @127.0.0.1 and @::1, because AMPLE's MariaDB doesn't resolve host names and PHP on Windows connects to "localhost" through 127.0.0.1.
يُستورد mysql\data فقط (وتُتجاهل النسخ الأخرى مثل data_backup). والحسابات @localhost تُنشأ أيضاً بـ @127.0.0.1 و @::1، لأن MariaDB في AMPLE لا يحوّل أسماء الأجهزة، و PHP على Windows يتصل بـ «localhost» عبر 127.0.0.1.