zpl-library-demo/
├── app/
│ ├── Http/
│ │ ├── Controllers/
│ │ │ └── ZplController.php
│ ├── Models/
│ │ └── Template.php
├── database/
│ ├── migrations/
│ │ ├── 2024_05_24_185822_create_templates_table.php
│ └── seeds/
│ └── TemplateSeeder.php
├── public/
│ └── assets/
│ └── john.png
│ └── tarik.png
├── resources/
├── routes/
│ └── web.php
├── storage/
│ └── app/
│ └── templates/
│ └── designTmp.zpl
│ └── sample1.xml
│ └── sample2.xml
│ └── templateSchema.xsd
│ └── zpl/
├── tests/
├── .env.example
├── composer.json
├── phpunit.xml
└── README.md
└── postman_collection.json
This project is a Laravel-based library for generating ZPL files from XML templates and dynamic data.
-
Clone the repository:
git clone https://github.com/itsTarikBTW/zpl-library-demo.git cd zpl-library-demo
-
Install dependencies:
composer install
-
Set up the environment:
cp .env.example .env php artisan key:generate
-
Configure your
.env
file with your database credentials. -
Run migrations:
php artisan migrate
-
Seed the database with an example template (optional):
php artisan db:seed --class=TemplateSeeder
-
Import the Postman collection to test the API.
-
Start the Laravel development server:
php artisan serve
-
Send a POST request to
/upload-template
with a name and a file namedtemplate
to upload a new template. -
Send a POST request to
/generate-zpl/{id}
with dynamic data to generate ZPL.
Run the following command to run the tests:
php artisan test
This project is a demo and should not be used in production. The CSRF middleware is disabled for demonstration purposes.
This project is open-source software licensed under the MIT license.