Download the PHP package kematjaya/crud-maker-api-bundle without Composer

On this page you can find all versions of the php package kematjaya/crud-maker-api-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package crud-maker-api-bundle

kematjaya/crud-maker-api-bundle

Command Symfony MakerBundle yang men-generate sisi tulis (write-side) dari sebuah resource API Platform (Input DTO, Service, WriteProcessor, endpoint export CSV) untuk entity Doctrine yang sudah ada, plus sidecar crud-specs/{Entity}.json yang dibaca @kematjaya/crud-ui-generator untuk men-generate frontend Next.js yang sepadan (halaman list/create/edit, tabel dengan search/pagination/bulk-delete/export CSV, form, BFF proxy routes).

Jalur kode terpisah dari kematjaya/crud-maker-twig-bundle — pakai bundle itu kalau Anda merender view Twig sisi server, bukan aplikasi API Platform + Next.js.

1. Instalasi

Daftarkan bundle-nya di config/bundles.php:

Bundle ini tidak membutuhkan symfony/twig-bundle, symfony/form, atau symfony/security-csrf — hanya yang benar-benar dibutuhkan untuk generate CRUD API Platform. Anda tetap perlu api-platform/symfony di project secara terpisah (maker akan mengecek dan memberi peringatan kalau tidak ada, tapi tidak memaksanya sebagai dependency composer wajib).

2. Siapkan entity-nya

Entity-nya harus sudah ada (make:entity atau ditulis manual) beserta repository class-nya. Kedua bentuk berikut didukung — maker mendeteksi bentuk mana yang dipakai entity Anda dan men-generate kode yang sesuai:

Kalau tidak ada pola yang cocok (misalnya constructor dengan argumen wajib tapi tanpa update() yang sepadan, atau ada field yang tidak punya setter), command akan gagal dengan pesan error yang jelas alih-alih diam-diam men-generate kode yang rusak.

3. Jalankan maker-nya

Command ini akan menanyakan:

Pertanyaan Maksud
entity-class Entity yang mau dibuatkan CRUD-nya (ada autocomplete)
owner-property Properti relasi yang membatasi baris data ke user saat ini (mis. owner) — isi - kalau tidak ada
with-tests Generate test PHPUnit untuk Service-nya?
searchable-fields Nama field, dipisah koma, yang bisa dicari dari frontend (mis. title) — isi - kalau tidak ada
write-entity-attributes Tambahkan #[ApiResource]/#[ApiFilter] ke file entity secara otomatis? (default: ya) — lihat di bawah. Tetap ditanya (tidak seperti dua baris berikutnya) karena ini MENGEDIT file entity yang sudah ada, bukan cuma menulis file baru.
relation-display-fields Label dropdown untuk relasi #[ORM\ManyToOne] yang entity terkaitnya BELUM pernah di-generate lewat command ini (lihat "Relasi ManyToOne" di bawah) — format properti:field, pisah koma kalau lebih dari satu (mis. category:name), isi - kalau tidak ada relasi semacam itu

Dua hal berikut TIDAK ditanya — otomatis di-default, tetap bisa di-override lewat argumen posisional non-interaktif (lihat contoh di bawah) kalau perlu:

Argumen Default otomatis
permission-prefix pluralize(nama entity), huruf kecil (mis. Category → categories). Catatan: ini hanya label bebas untuk permission key dan route frontend — bukan URL API sebenarnya. URL resource API Platform yang sesungguhnya selalu berupa pluralize(tableize($shortName)) dan ditulis apa adanya ke field apiResourcePath di spec JSON, terlepas dari nilai permission-prefix ini — jadi biasanya sama, tapi kalau di-override manual bisa beda (lihat "Relasi ManyToOne" soal kenapa perbedaan ini penting untuk field relasi).
with-access-control true — gerbangi create/edit/delete/export lewat isGranted() dari kematjaya/access-control-bundle

Non-interaktif:

Relasi ManyToOne

Setiap properti #[ORM\ManyToOne] pada entity — SELAIN yang dipilih sebagai owner-property untuk run ini (itu ditangani terpisah lewat CurrentUser{Entity}Extension, bukan lewat mekanisme ini) — otomatis terdeteksi dan diperlakukan sebagai field relasi: masuk ke Input DTO dengan tipe entity terkait (plus #[ApiProperty(schema: ['type' => 'string', 'format' => 'iri-reference'])] supaya openapi-typescript di frontend generate tipe string bukan schema Category penuh), dikecualikan dari trim() di Service, dan ditulis ke crud-specs/{Entity}.json sebagai "type": "relation" — field JSON inilah yang membuat @kematjaya/crud-ui-generator merender field-nya sebagai react-select AsyncSelect pencarian server-side alih-alih <select> native (lihat js/README.md).

Field relasi butuh tahu properti mana di entity terkait yang jadi label dropdown-nya (displayField/searchParam), dan URL BFF frontend entity terkait (relatedFrontendPath) — dua hal yang tidak bisa ditebak dari metadata Doctrine saja:

  1. Kalau entity terkait sudah pernah di-generate lewat make:kmj-api-crud (sudah punya crud-specs/{RelatedEntity}.json sendiri): kedua nilai itu otomatis diambil dari situ — field searchable pertama di sana jadi displayField/searchParam, dan permissionPrefix-nya jadi relatedFrontendPath. Tidak perlu isi apa-apa.
  2. Kalau belum (mis. relasi ke entity yang bukan resource CRUD sendiri): isi argumen relation-display-fields (lihat tabel di atas). Kalau tidak diisi, command GAGAL dengan pesan error yang jelas — generator ini sengaja tidak menebak sembarang properti (mis. asal pilih name) sebagai fallback diam-diam.

relatedApiResourcePath (URI ApiPlatform asli entity terkait, ditanam sebagai prefix IRI yang disubmit) SELALU dihitung deterministik (pluralize(tableize($relatedEntity))), sama seperti apiResourcePath di level entity itu sendiri — tidak bergantung pada permissionPrefix entity terkait, jadi tidak perlu sidecar atau argumen tambahan untuk nilai ini. Ini sengaja dipisah dari relatedFrontendPath — menggabungkan keduanya jadi satu nilai adalah persis bug yang pernah ditambal untuk apiResourcePath/permissionPrefix di level entity (lihat catatan di js/README.md dan js/src/spec.ts).

Hanya ManyToOne yang didukung — OneToOne/OneToMany/ManyToMany dilewati begitu saja (tidak dianggap error, cuma tidak diproses sebagai field).

4. Apa saja yang ditulis

Kalau salah satu file config di atas tidak ditemukan, atau strukturnya tidak dikenali, writer akan mencetak bloknya saja untuk Anda tempel manual, bukan menggagalkan seluruh command — tetap cek next-steps yang dicetak di kedua kondisi.

5. Langkah manual yang tersisa (dicetak setelah generate)

6. Generate frontend-nya (@kematjaya/crud-ui-generator)

Sidecar crud-specs/{Entity}.json dari langkah 4 dikonsumsi oleh @kematjaya/crud-ui-generator, generator frontend CRUD untuk Next.js yang dipublikasikan ke npm — sumbernya ada di js/ di monorepo kematjaya/crud-maker-bundle (paket npm terpisah, bukan composer/PHP — bundle ini hanya menghasilkan spec JSON yang dibacanya). Generator ini dijalankan saat development (seperti Plop/Hygen), bukan library komponen runtime.

Prasyarat

Generator ini menyasar project yang sudah mengikuti konvensi Next.js di ekosistem ini — menjalankannya pada project yang belum punya komponen-komponen berikut akan menghasilkan file yang tidak bisa di-compile sampai Anda menambahkannya:

Instalasi & cara pakai

Tidak perlu instalasi terpisah untuk pemakaian sekali pakai — npx akan mengambilnya otomatis:

Kalau lebih suka dipasang sebagai dev dependency permanen daripada npx setiap kali:

Apa saja yang di-generate

Per entity (dilewati kalau file sudah ada — aman dijalankan ulang):

Primitive UI bersama, tidak spesifik satu entity (ditulis sekali, dipakai ulang semua entity): components/crud/DeleteConfirmModal.tsx, BulkActionsBar.tsx, PaginationBar.tsx, SearchPanel.tsx, ExportAllButton.tsx.

Ditambahkan ke (multi-entity, idempotent — tiap entity dapat satu blok yang dijaga marker): lib/api-shapes.ts, lib/schemas.ts (satu Zod schema per entity), types/api.ts.

Catatan penting

Lihat js/README.md di monorepo (atau halaman npm) untuk referensi lengkap dan paling baru — bagian ini bisa saja tertinggal dari versi npm yang lebih baru.

Meng-override template generator

Template custom dicari lebih dulu, baru jatuh kembali ke skeleton bawaan bundle — Anda hanya perlu meng-override yang memang ingin diubah.


All versions of crud-maker-api-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
kematjaya/crud-maker-core Version ^8.0
symfony/http-kernel Version ^7.0|^8.0
symfony/dependency-injection Version ^7.0|^8.0
symfony/config Version ^7.0|^8.0
symfony/console Version ^7.0|^8.0
symfony/routing Version ^7.0|^8.0
symfony/validator Version ^7.0|^8.0
symfony/http-foundation Version ^7.0|^8.0
symfony/translation Version ^7.0|^8.0
symfony/yaml Version ^7.0|^8.0
doctrine/orm Version ^3.5
doctrine/doctrine-bundle Version ^3.2
symfony/maker-bundle Version ^1.60
nikic/php-parser Version ^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kematjaya/crud-maker-api-bundle contains the following files

Loading the files please wait ...