我应该使用哪个框架来确保更好的长期升级/可维护性,CakePHP 还是 CodeIgniter?

发布于 2024-07-08 21:56:50 字数 419 浏览 11 评论 0原文

我正在决定尝试一个 PHP 框架。 我已将范围缩小到 CakePHP 和 CodeIgniter。 对于曾经使用过或熟悉两者的人,我有几个问题:

  1. 我喜欢 CakePHP 默认将大部分代码保留在 Webroot 之外的事实。 特别是因为我最终可能会为多个应用程序使用单个框架安装。 我看到 CodeIgniter 也会这样做,但你必须配置它并移动一些东西。 这种解决方法安全可靠吗?还是事后才想到的黑客攻击?

  2. 哪一个(如果不是两者)更容易升级和长期维护? 随着框架(以及 PHP 本身)的新版本的出现。 我不想发现我的东西要么损坏,要么过时。

编辑:

这是一篇非常旧的帖子,但我想我会用我最终所做的事情来更新它,即使用 Kohana。

I am deciding on a framework to try out for PHP. I have narrowed it down to CakePHP and CodeIgniter. I have a couple of questions for any of you who have used or are familiar with both:

  1. I like the fact that CakePHP keeps most of the code outside of the webroot by default. Especially since I may end up using a single framework install for multiple apps. I see CodeIgniter will do that too, but you have to configure it and move some stuff around. Is that workaround secure and reliable, or is it an afterthought hack?

  2. Which (if not both) is easier to upgrade, and maintain over the long term? As new versions of the framework (and PHP itself) come out. I don't want to find my stuff either breaking, or becoming outdated.

Edit:

This is a very old post, but I thought I would update it with what I finally ended up doing, which was to use Kohana.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

那一片橙海, 2024-07-15 21:56:50

您应该尝试这两个框架一周左右的时间,在这两个框架中构建一些简单的东西(例如博客或wiki),然后看看您更喜欢使用哪个。 无论对您来说最有意义的是什么,都可能通过升级和弃用为您提供最长的支持。

CakePHP 目前处于有点不稳定的状态,在发布 1.2 版本(不向后兼容)的同时仍在挖掘错误。 如果您现在需要坚如磐石的东西,我不建议使用它构建关键应用程序。 如果你可以等待一两个月才能解决问题,那么这可能是一个没有实际意义的问题。

为了解决您的担忧:

1)Cake 和 CI 的做法相同(iirc)。 它们在这方面同样安全、可靠且具有黑客性。

2)一切都变了。 如果您需要具体、永久的稳定性和向后兼容性保证,请推出您自己的框架。 没有太多的内容,而且除非您愿意,否则保证不会发生任何改变。

You should try both frameworks for a week or so, building something trivial (like a blog or wiki) in both, and see which you prefer using. Whatever makes the most sense to you will probably sustain you the longest through upgrades an deprecations.

CakePHP is in a bit of a volatile state right now, still unearthing bugs while pushing to release version 1.2 (which is not backward compatible). I wouldn't suggest building a critical application with it if you need something rock solid right now. If you can wait a month or two for things to settle, then it's probably a moot point.

To address your concerns:

1) Cake and CI do it the same way (iirc). They are equally secure, reliable, and hackish on this front.

2) Everything changes. If you need concrete, perpetual assurance of stability and backward compatibility, roll your own framework. There's not that much to it, and you're guaranteed that nothing changes unless you want it to.

岁月静好 2024-07-15 21:56:50

我已经在 CakePHP 上部署了多个应用程序,这是一次非常非常好的体验。 无论哪种方式都不会出错,因为两者都是可靠的。

I have deployed multiple applications on CakePHP and it's been a very, very, nice experience. You can't go wrong either way, as both are solid.

白龙吟 2024-07-15 21:56:50
  1. 不是问题。

  2. CodeIgniter 背后有赞助商,因此它绝对是长期选择。 而且,速度更快。

  1. is a non-issue.

  2. CodeIgniter has a sponsor behind it, so it's definately the one to choose for the long term. Also, it's faster.

累赘 2024-07-15 21:56:50
  1. 这不是问题。 该应用程序有几行内容说明了核心和应用程序代码所在的位置。 您只需要更改这些行即可。

  2. 你永远无法预料到这一点。

PHP 的状态在这里是一个通配符。 一个应用程序 (CI) 构建为与 PHP4 兼容,另一个则需要 PHP5。 如果您需要处理 Web 主机仅支持旧版本 PHP 的可能性,那么您需要使用 CO。

另一个问题是单元测试。 如果您需要框架附带测试,那么 CI 不是最佳选择。

就我个人而言,由于有企业的支持,我对 CI 感觉很舒服。 CI 背后的公司正在从他们的努力中获得真正的利润。 尽管 CI 是免费的,但他们的付费产品(ExpressionEngine)最终将在 CI 上运行。 Zend Framework 甚至 Rails 的诞生(最初是为 Basecamp 构建的)也是如此。

  1. This is a non issue. The app has a couple of lines which says where the core and your application code lies. You just need to change those lines.

  2. You can never anticipate this one.

The state of PHP is a wildcard here. One app (CI) is built to be compatible with PHP4 the other requires PHP5. If you need to deal with the possibilty of a web host only supporting older versions of PHP then you need to go with CO.

Another issue is unit testing. If you require your framework to ship with tests, then CI is not the way to go.

Personally, I feel comfortable with CI because of the corporate backing. The company behind CI is making real profit from their efforts. Though CI is free, their paid product (ExpressionEngine) will eventually live on CI. The same could be said of the Zend Framework and even the birth of Rails (originally built for Basecamp.)

清风无影 2024-07-15 21:56:50

对上述评论的一个小修正:两者都与 PHP4 兼容,而不仅仅是 CI。 另外,我不认为拥有赞助商会使 CI 或多或少可升级或可维护。 钱根本解决不了这些问题。

我将 CakePHP 用于各种应用程序,到目前为止我对它很满意。 1.2 比 1.1 有了巨大的改进,虽然库源可能从 RC3 更改为 Final,但我认为您编写的任何代码都不会过时。 我唯一的小问题是,手册并没有应有的那么全面(在我看来),而且我最终还是使用了很多 API。 代价是我现在非常了解幕后的代码。 无论如何,我强烈推荐它。

另一方面,我从未使用过 CI,所以我不能推荐 CakePHP 而不 CI。 我会把每一个都试一试,看看哪一个能吸引你。 无论你选择哪一个,都要研究它的惯例和功能。 当我开始使用 Cake 时,我无意中编写了一堆代码来执行 Cake 通过让我在控制器中设置一个变量来“自动”执行的操作。

A minor correction to an above comment: both are compatible with PHP4, not just CI. Also, I don't think that having a sponsor makes CI and more or less upgradable or maintainable. Money doesn't solve those problems in the least.

I use CakePHP for a variety of applications and I've been happy with it thus far. 1.2 is a huge improvement over 1.1, and while the library source may change from RC3 to Final, I don't think any code you write will become obsolete. My only niggle is that the Manual isn't as comprehensive as it should be (in my opinion), and I end up in the API quite a bit. The trade-off there is that I now understand the code behind the scenes very well. In any case, I highly recommend it.

On the other hand, I've never played around with CI, so I can't recommend CakePHP over CI. I would take each for a spin and see which one grabs you. Whichever one you choose, study the hell out of its conventions and capabilities. When I started with Cake, I unwittingly wrote a bunch of code to do something Cake did "automagically" by having me set one variable in the controller.

复古式 2024-07-15 21:56:50

CodeIgniter 非常灵活,您一旦尝试就会发现。 因此,您的应用程序如何维护将取决于您。

我还使用同一安装部署了多个应用程序。 我通常为 CMS 项目创建 2 个应用程序(一个用于管理,一个用于前端)。

CodeIgniter is very flexible as you would see once you try it. So how your application would be maintainable would fall you your hands.

I have also deployed multiple applications using the same installation. I usually create 2 applications for CMS projects (one for admin, one for the front-end).

等待圉鍢 2024-07-15 21:56:50

从 CodeIgniter 的角度解决您的两个问题(我不使用 Cake):

1)CodeIgniter 默认情况下不会将自己保留在 webroot 之外,但它可以通过一些非常简单的更改来做到这一点。 我的 CI 教程的第一部分系列解释了如何执行此操作,并逐步介绍了新 CI 实例的设置。 完成后,CI 中唯一需要位于 webroot 中的部分是一个小的 index.php 引导文件。

2) 我有一个最初在 CI 1.4.x 中开发的应用程序,我已成功迁移到 1.5.x,然后迁移到 1.6.x。 对于每个新版本,CI 开发人员都会提供详细的升级说明,列出需要替换的内容,因此升级相当容易。

吉姆.

To address both of your questions from a CodeIgniter perspective (I don't use Cake):

1) CodeIgniter doesn't keep itself outside the webroot by default, but it can do so with some very simple changes. The first part of my CI tutorial series explains how to do so, along with a walk through of the setup of a new CI instance. Once finished the only part of CI that needs to be in the webroot is a small index.php bootstrap file.

2) I've got an application which I originally developed in CI 1.4.x and I've sucessfully migrated to 1.5.x then 1.6.x. With each new release the CI dev's make available detailed upgrade instructions laying out what needs to be replaced so upgrades are fairly easy.

Jim.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文