PHP code example of wiserwebsolutions / laravel-pde-client
1. Go to this page and download the library: Download wiserwebsolutions/laravel-pde-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wiserwebsolutions / laravel-pde-client example snippets
use WiserWebSolutions\PDEClient\Facades\PDE;
PDE::district('101260303')->year('2024-2025')->financials()->budget()->revenues()->get();
PDE::district('101260303')->enrollments()->withProjections()->get();
PDE::district('101260303')->assessments()->pssa()->allStudents()->get();
PDE::district('101260303')->assessments()->graduation()->group('Total')->get();
PDE::district('101260303')->personnel()->classroomTeachers()->get();
PDE::district('101260303')->enrollments()->economicallyDisadvantaged()->get();
PDE::district('101260303')->financials()->fundBalance()->get();
// district()/year() also work directly on any dataset query, in any order
PDE::query()->financials()->district('101260303')->year('2024-25')->account('6111')->sole();
// Every account for a district, most recent year published, budget and actual side by side
PDE::district('101260303')->financials()->get();
// One year
PDE::district('101260303')->year('2024-2025')->financials()->get();
// Actual amounts for all revenue accounts, most recent year
PDE::district('101260303')->financials()->actual()->revenues()->get();
// Budgeted amounts for all expenditure functions, one year
PDE::district('101260303')->year('2019-2020')->financials()->budget()->expenses()->get();
// One account line; variance() = actual - budget - drill into accounts for the FinancialRecord itself
$line = PDE::district('101260303')->year('2024-25')->financials()->account('6111')->sole()->accounts->sole();
$line->budget; $line->actual; $line->variance();
// Defaults: configured district, most recent year published for the requested measure(s)
PDE::query()->financials()->actual()->revenues()->total();
// Every year published for the requested measure(s) instead of just the most recent
PDE::district('101260303')->financials()->allYears()->actual()->revenues()->get();
// Nest sibling dataset(s) straight into that year's FinancialYearSummary instead of querying them separately
PDE::district('101260303')->year('2024-2025')->financials()->withFundBalance()->withActOneIndex()->sole();
PDE::district('101260303')->year('2024-2025')->financials()->withAllDatasets()->sole(); // every sibling dataset nested in
$line = PDE::district('101260303')->year('2024-25')->financials()->account('6111')->sole();
$line->parentCode; // '6110'
$line->parent(); // FinancialRecord for 6110 (Ad Valorem Taxes), or null at the top of the tree
$line->parent()?->parent()?->accountCode; // '6100', walking further up
$line->children(); // Collection<FinancialRecord> - empty here, 6111 is a leaf
$line->isLeaf(); // true
// Single year -> a single EnrollmentYearSummary, not wrapped in a Collection
$year = PDE::district()->year('2024-2025')->enrollments()
->withEnglishLearners()
->withEconomicallyDisadvantaged()
->get();
$year->enrollmentTotal; // sum of count() across every actual general-enrollment grade
$year->englishLearnersTotal; // sum across every EL grade - populated, since withEnglishLearners() was called
$year->projectedEnrollmentTotal; // null - withProjections()/onlyProjections() wasn't called
$year->economicallyDisadvantagedTotal; // the count, matching the naming of the other totals
$year->economicallyDisadvantaged?->percentEconomicallyDisadvantaged; // the rest of that dataset's detail
$year->grades; // Collection<EnrollmentRecord> - one row per grade, every selected dataset merged in
$k = $year->grades->firstWhere('grade', 'K');
$k->count; // general enrollment K count
$k->subCounts; // ['K5A' => 8, 'K5F' => 120, ...] - the raw AM/PM/full-day columns summed into count
$k->englishLearnersCount; // EL K count - populated on this same record, not a separate one
$k->projectedCount; // null here - withProjections()/onlyProjections() wasn't called
// Multi-year -> a Collection<EnrollmentYearSummary>
$years = PDE::district()->enrollments()->allYears()->get();
$years->firstWhere('schoolYear', '2023-2024')->enrollmentTotal;
// Actual and projected, side by side / projections only
PDE::district()->enrollments()->withProjections()->get(); // actual AND projected rows together
PDE::district()->enrollments()->onlyProjections()->get(); // projected rows only, instead of actual
PDE::district()->enrollments()->withoutProjections()->get(); // actual only - the default; undoes with/onlyProjections()
// English learner counts
PDE::district()->enrollments()->withEnglishLearners()->get(); // general enrollment AND EL counts, side by side
PDE::district()->enrollments()->onlyEnglishLearners()->get(); // EL counts instead of general enrollment
PDE::district()->enrollments()->withAllDatasets()->get(); // every dataset this query can blend in, INCLUDING economically disadvantaged
// One grade
$k = PDE::district()->year('2024-2025')->enrollments()->grade('K')->sole();
$k->grades->sole()->count; // normalized total
PDE::district()->enrollments()->economicallyDisadvantaged()->get(); // most recent year (2016-17 onward)
PDE::district()->year('2024-2025')->enrollments()->economicallyDisadvantaged()->sole()->percentEconomicallyDisadvantaged;
PDE::district()->enrollments()->economicallyDisadvantaged()->allYears()->get(); // every year published
// Both exams, every subject/grade/group, most recent published year
PDE::district()->assessments()->get();
// Every published year instead of just the most recent
PDE::district()->assessments()->allYears()->get();
// One exam, one subject, all-students only
PDE::district()->year('2024-2025')->assessments()->pssa()->subject('Math')->allStudents()->get();
PDE::district()->assessments()->keystone()->subject('Algebra I', 'Biology')->get();
// The aggregate row PDE publishes per subject ('Total' spans all tested grades)
$line = PDE::district()->year('2024-2025')->assessments()->pssa()
->subject('Math')->grade('Total')->allStudents()->sole();
$line->percentProficientOrAbove;
PDE::district()->assessments()->graduation()->get(); // 4-year rates (the standard), most recent year
PDE::district()->year('2023-2024')->assessments()->graduation()->group('Total')->sole()->rate;
PDE::district()->assessments()->graduation()->cohortYears(6)->get(); // students finishing within 6 years
PDE::district()->assessments()->graduation()->allYears()->get(); // every group/year published
// Dropout summaries instead (Collection<DropoutRecord>)
PDE::district()->assessments()->graduation()->dropouts()->get();
PDE::district()->personnel()->get(); // every category, most recent year (2012-13 onward)
PDE::district()->year('2025-2026')->personnel()->classroomTeachers()->sole()->averageSalary;
PDE::district()->personnel()->administrators()->get();
PDE::district()->personnel()->category('coordinator', 'other')->get();
PDE::district()->personnel()->allYears()->get(); // every year published
PDE::district()->enrollments()->averageDailyMembership()->get(); // most recent year (2015-16 onward)
PDE::district()->year('2024-2025')->enrollments()->averageDailyMembership()->sole();
PDE::district()->enrollments()->adm()->sole()->wadm; // adm() is a shorthand alias
PDE::district()->enrollments()->adm()->allYears()->get(); // every year published
PDE::district()->financials()->realEstateTaxRates()->get(); // most recent year, every county line (2016-17 onward)
PDE::district()->year('2024-2025')->financials()->realEstateTaxRates()->sole()->mills;
PDE::district()->financials()->taxRates()->get(); // taxRates() is a shorthand alias
PDE::district()->financials()->taxRates()->allYears()->get(); // every year published
PDE::district()->financials()->fundBalance()->get(); // most recent year (2015-16 onward)
PDE::district()->year('2024-2025')->financials()->fundBalance()->sole()->total(); // sum of whichever fields are present
PDE::district()->financials()->fundBalance()->allYears()->get(); // every year published
PDE::district()->financials()->indebtedness()->get(); // most recent year, every combination
PDE::district()->year('2024-2025')->financials()->indebtedness()->fundType('governmental')->phase('end')->sole()->total;
PDE::district()->financials()->indebtedness()->allYears()->get(); // every year published
PDE::district()->financials()->selectedData()->get(); // most recent year (2013-14 onward)
PDE::district()->year('2022-2023')->financials()->selectedData()->sole()->instructionExpensePerWadm; // Actual Instruction Expense per WADM
PDE::district()->year('2022-2023')->financials()->selectedData()->sole()->totalExpenditurePerAdm; // Total Expenditures per ADM
PDE::district()->financials()->selectedData()->allYears()->get(); // every year published
PDE::district()->financials()->actOneIndex()->get(); // most recent year (2015-16 onward)
PDE::district()->year('2024-2025')->financials()->actOneIndex()->sole()->index;
PDE::district()->financials()->actOneIndex()->allYears()->get(); // every year published
// GFB - one file per school year
$latest = PDE::gfb()->latest();
PDE::gfb()->schoolYear('2024-25')->download();
// AFR - grouped by category, multi-year workbooks
PDE::afr()->revenues()->get(); // Collection<RemoteFile>
PDE::afr()->matching('Local Revenue')->sole()->url;
PDE::afr()->expenditures()->download(disk: 's3', directory: 'afr/expenditures');
// Enrollment - categorized by URL path (public, projections, english_learners, ...)
PDE::enrollmentFiles()->category('public')->matching('2024-2025')->sole()->url;
PDE::enrollmentFiles()->matching('School District Enrollment Projections')->sole()->download();
// Assessments (pssa, keystone), graduation (cohort, dropouts), personnel
// (staff_summary, individual, ...) follow the same pattern - e.g. the ~35MB
// per-year individual staff reports are downloadable even though the query
// layer doesn't model them:
PDE::personnelFiles()->category('individual')->matching('2025-26')->sole()->download();
// Financial data elements - categorized by URL path (average_daily_membership,
// real_estate_tax_rates, selected_data, aid_ratios, personal_income); the
// last two are discoverable/downloadable but not modeled in the query layer:
PDE::financialDataElementsFiles()->category('aid_ratios')->matching('2024-25')->sole()->download();
// Act 1 Index - categorized by filename (adjusted_index_history is the
// per-district, multi-year workbook the query layer is built on;
// adjusted_index_current and base_index_history are discoverable/
// downloadable but not modeled):
PDE::actOneIndexFiles()->category('base_index_history')->sole()->download();