PHP – How to structure this application

Sorry if the title is leading.. I’m looking for advice for the following system I am implementing:

The system is to provide quotes for customers, this is then exported to PDF and emailed to the customer. Basically, the “quote” consists of the following:

  • Font cover (Images – Pulled from a database)
  • Attributes – (This is the actual quote)
  • Header image – (Product images – Pulled from the database)
  • Customers information (Customers details for the quote)
  • T&C

I have made classes for each and declared an object. Which is then passed to the final object Quote but the problem is this:

I’m using PHP and the UI works so that each of these sections is a page. So, page 1 = front cover, Attributes = page 2 etc.. The final page, is where the Quote object is created and stored within the database. But, at each of the sections, the user has the ability to view the details up to this point.

I have been using sessions for this, but, now, I have 5 sessions and all of these form 1 object (which is stored as a session) – Is there a more practical way to do this? And if there is, how would I transfer the previous information to the next section?

Any advice, greatly appreciated.

If you want to preserve data across the pages, there are several approaches:

  • The URI or the form. A wrong choice in most situations (some ASP.NET developers would disagree, pointing to view state as an example of preserving information in a form).

  • Sessions. This works well for most cases if the size of the preserved data is not very large.

  • Database (including Redis). The benefits, compared to sessions, is that:

    1. The size of the data is irrelevant, and doesn’t impact the memory footprint of your web application.

    2. If the web application or the web server crashes, the data is still there.

    3. The data is persisted forever (well, until you decide you don’t need it any longer), which is ideal for cases where you want to keep the data even if the user leaves and comes back a few days, weeks or months later.

    4. Failover/mirroring scenarios become much easier than with sessions.

From your description, it seems that you don’t necessarily need the benefits of persistence inside a database. Sessions appear a good approach here.

Note that the number of sessions depends on the number of users, with one session per user. Two users—two sessions, independently of how much objects are stored in the sessions. This means that:

now, I have 5 sessions and all of these form 1 object

doesn’t make too much sense. Either you are calling session something which are not an actual session, or you ended up thinking that there are multiple sessions, where there is only one.

4

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật