1. Go to this page and download the library: Download cable8mm/order-sheet 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/ */
cable8mm / order-sheet example snippets
// src/Factories/NewCompanyFactory.php
namespace Cable8mm\OrderSheet\Factories;
class NewCompanyFactory extends Factory
{
public function definition(): array
{
return [
'주문번호' => Faker::shared()->randomNumber(10),
'주문일' => Faker::make()->dateTime(),
// ... 더 많은 필드들
];
}
}
// src/Enums/OrderSheetType.php
enum OrderSheetType
{
case PlayautoType;
case NewCompanyType; // 새 타입 추가
public function factoryClass(): string
{
return match ($this) {
self::PlayautoType => PlayautoFactory::class,
self::NewCompanyType => NewCompanyFactory::class, // 새 Factory 매핑
};
}
}
use Cable8mm\OrderSheet\OrderSheet;
use Cable8mm\OrderSheet\Enums\OrderSheetType;
// 헤더를 포함한 XLSX 파일로 저장
OrderSheet::of(OrderSheetType::PlayautoType)
->count(10) // 10개의 데이터 생성
->header() // 헤더 행 포함
->path('dist') // 저장할 경로 지정
->xlsx('my.xlsx'); // xlsx 파일로 내보내기 (기본: 'order_sheet.xlsx')
// 주문당 2개 상품 행을 포함한 6개 주문 행 생성
// 묶음 주문의 주문번호, 구매자/수령자, 날짜, 배송 정보와 합계는 행 간에 일치합니다.
$bundledOrders = OrderSheet::of(OrderSheetType::PlayautoType)
->count(6)
->bundle(2)
->header()
->toArray();
// 헤더 없이 CSV 문자열로 내보내기
$csv = OrderSheet::of(OrderSheetType::PlayautoType)
->count(10)
->csv();
// 헤더 없이 배열로 내보내기
$array = OrderSheet::of(OrderSheetType::PlayautoType)
->count(10)
->toArray();
// state()로 특정 필드 값 변경
$customData = OrderSheet::of(OrderSheetType::PlayautoType)
->count(5)
->state([
'상태' => '배송완료', // 상태 필드 변경
'구매자명' => '홍길동', // 구매자명 필드 변경
])
->toArray();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.