Install
$ agentstack add skill-pledgeandgrow-pledge-skills-php ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ● Network access Used
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
PHP Expert (8.5)
Official Documentation: https://www.php.net/manual/en/
Quick Reference
| Topic | File | |-------|------| | Installation (Linux, macOS, Windows, Docker), php.ini config, web server setup, SAPI types | getting-started.md | | PHP tags, escaping HTML, instruction separation, comments | basics-syntax.md | | Types (null, bool, int, float, string, array, object, callable, iterable, mixed, void, never, resource), type declarations, type juggling | types.md | | Variables, scope, predefined variables, variable variables, external sources | variables.md | | Constants, define(), const, magic constants, predefined constants | constants.md | | Operators (arithmetic, assignment, bitwise, comparison, error control, execution, logical, string, array, type, functional), precedence | operators.md | | Control structures (if, else, elseif, while, do-while, for, foreach, switch, match, declare, return, require, include, goto) | control-structures.md | | Functions, parameters, arguments, returning values, anonymous, arrow, first-class callable | functions.md | | Classes, objects, properties, property hooks, constants, autoloading, constructors, visibility, inheritance, static, abstract, interfaces, traits, anonymous classes, overloading, magic methods, final, cloning, late static bindings, serialization, covariance/contravariance, lazy objects | classes-objects.md | | Namespaces, sub-namespaces, importing/aliasing, global space, name resolution | namespaces.md | | Enumerations (basic, backed, methods, static methods, constants, traits, listing, serialization) | enums.md | | Errors, error levels, error handling, error reporting | errors.md | | Exceptions, try/catch/finally, extending exceptions, multiple catch types, global handler | exceptions.md | | Generators, yield, yield from, Generator class, comparison with Iterator | generators.md | | Fibers, Fiber class, suspend/resume/throw, full-stack interruptible functions | fibers.md | | Attributes, syntax, declaring attribute classes, reading with Reflection | attributes.md | | References, reference counting, passing by reference, returning references | references.md | | Predefined variables ($SERVER, $GET, $POST, $SESSION, $ENV, $GLOBALS), predefined exceptions, predefined interfaces/classes, predefined attributes | predefined.md | | Security (sessions, filesystem, database, SQL injection, error reporting, user data, hiding PHP, keeping current) | security.md | | Features (HTTP auth, cookies, sessions, file uploads, remote files, connection handling, persistent DB connections, CLI, garbage collection, DTrace) | features.md | | Standard library: strings, arrays, arrays sorting, function handling, output control, error handling | stdlib-core.md | | Standard library: date/time (DateTime, DateTimeImmutable, DateTimeZone, DateInterval, DatePeriod), calendar, HRTime | stdlib-date.md | | Standard library: math, BCMath, GMP, statistics, RoundingMode enum | stdlib-math.md | | Standard library: hash, OpenSSL, password hashing, sodium, Rnp, Xpass | stdlib-crypto.md | | Standard library: JSON, SimdJSON, cURL, DOM, SimpleXML, XMLReader, XMLWriter, XSL, XML-RPC | stdlib-xml-json.md | | Standard library: PDO, MySQL (mysqli), PostgreSQL, SQLite3, MongoDB, OCI8, ODBC, DBA, SQLSRV | stdlib-database.md | | Standard library: SPL (datastructures, iterators, exceptions, functions), reflection, fileinfo, filesystem, directories | stdlib-spl-io.md | | Standard library: compression (Phar, Zip, Zlib, Bzip2, Rar, LZF), intl, iconv, mbstring, gettext, GD, ImageMagick, Exif | stdlib-extended.md | | Standard library: PCNTL, POSIX, program execution, FFI, OPcache, session, filter, ctype, FTP, IMAP, mail, SOAP, OAuth, readline, APCu | stdlib-services.md | | Standard library: PCRE regex (pregmatch, pregreplace, pregsplit, preggrep), URL functions (parseurl, httpbuildquery, urlencode), stream functions and contexts, network functions (DNS, IP, headers), variable handling (vardump, serialize, debugbacktrace), PHP info functions | stdlib-regex-net.md | | Standard library: server-specific (Apache, LiteSpeed, FPM), Solr, FDF, GnuPG, wkhtmltox, PS, XLSWriter, Radius, GeoIP, FANN, Igbinary, Lua, CommonMark, Event, Yar, Eio, Ev, Expect, Enchant, Gender, Quickhash, dBase, Firebird, CUBRID, IBM DB2, Componere | stdlib-misc.md | | Composer, PIE, PECL, autoloading, dependency management, packaging | composer.md | | PHP 8.5 new features, 8.4/8.3/8.2/8.1/8.0 migration, deprecated features, backward incompatible changes | whats-new.md |
Core Philosophy
PHP is a widely-used, dynamically typed, general-purpose scripting language especially suited for web development. Key principles:
- Server-Side Scripting — PHP code is executed on the server, generating HTML sent to the client
- Dynamic Typing — types are determined at runtime, with type juggling and optional type declarations
- Embedded — PHP can be embedded directly into HTML using `` tags
- Multi-Paradigm — procedural, object-oriented, and functional styles all supported
- Cross-Platform — runs on all major operating systems (Linux, macOS, Windows)
- Rich Extension System — hundreds of built-in extensions for databases, crypto, XML, images, networking
- Composer — modern dependency manager and package ecosystem
- JIT Compiler — since PHP 8.0, a JIT compiler is available for improved performance
Hello World
` `=` `` | Comparison |
| `&&` `\|\|` `!` `and` `or` `xor` | Logical |
| `&` `\|` `^` `~` `>` | Bitwise |
| `.` | String concatenation |
| `??` `?:` | Null coalescing, ternary |
| `instanceof` | Type check |
| `++` `--` | Increment/decrement |
## Control Flow Quick Reference
```php
// if/elseif/else
if ($x > 0) {
echo "positive";
} elseif ($x = 0 ? "ok" : "error";
// Null coalescing
$name = $_GET['name'] ?? 'default';
// match (PHP 8.0+)
$result = match($status) {
200, 300 => 'success',
400 => 'not found',
500 => 'server error',
default => 'unknown',
};
// foreach
foreach ($items as $key => $value) {
echo "$key: $value\n";
}
// for
for ($i = 0; $i $x * $x;
// First-class callable syntax (PHP 8.1+)
$callable = strlen(...);
$callable = Closure::fromCallable('strlen');
// Anonymous function / Closure
$multiply = function (int $a, int $b): int {
return $a * $b;
};
Classes Quick Reference
// Basic class
class Dog {
public function __construct(
public readonly string $name, // constructor property promotion (PHP 8.0+)
) {}
public function bark(): string {
return "{$this->name} says woof!";
}
}
// Enum (PHP 8.1+)
enum Status: string {
case Active = 'active';
case Inactive = 'inactive';
public function label(): string {
return ucfirst($this->value);
}
}
// Interface + Trait
interface Repository {
public function find(int $id): ?object;
}
trait Timestampable {
public ?DateTimeImmutable $createdAt = null;
public ?DateTimeImmutable $updatedAt = null;
}
class User implements Repository {
use Timestampable;
public function __construct(
public readonly int $id,
public readonly string $email,
) {}
public function find(int $id): ?object {
// implementation
return null;
}
}
// Property hooks (PHP 8.4+)
class Account {
private string $name = '';
public string $displayName {
get => $this->name ?: 'Anonymous';
set => $this->name = trim($value);
}
}
Installation & Setup
# Check version
php --version
# Built-in development server
php -S localhost:8000
# Run a script
php script.php
# Built-in REPL
php -a
# Composer (package manager)
composer init
composer install
composer require vendor/package
composer update
# Create project from package
composer create-project laravel/laravel myapp
Project Creation
# Simple project
mkdir myproject && cd myproject
composer init --name="acme/myproject" --type="library" --license="MIT"
# With autoloading (PSR-4)
# composer.json:
# {
# "autoload": {
# "psr-4": { "Acme\\": "src/" }
# }
# }
composer dump-autoload
# Laravel project
composer create-project laravel/laravel myapp
cd myapp
php artisan serve
# Symfony project
composer create-project symfony/skeleton myapp
cd myapp
php -S localhost:8000 -t public
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: pledgeandgrow
- Source: pledgeandgrow/pledge-skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.